added existance check (not sure if it's working)
This commit is contained in:
parent
9a7c74e307
commit
a5aad09046
4 changed files with 78 additions and 13 deletions
|
|
@ -22,7 +22,12 @@ public class QuestionService : IQuestionService
|
|||
|
||||
public async Task AddQuestionAsync(QuestionBase question)
|
||||
{
|
||||
// TODO: проверить существование опроса
|
||||
var survey = await _surveyRepository.GetByIdAsync(question.SurveyId);
|
||||
if (survey is null)
|
||||
{
|
||||
throw new NotFoundException("Survey not found");
|
||||
}
|
||||
|
||||
await _questionRepository.AddAsync(question);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue