return created objects

This commit is contained in:
Вячеслав 2025-05-13 18:08:51 +05:00
parent 251810c973
commit 98b38f645f
2 changed files with 6 additions and 4 deletions

View file

@ -47,11 +47,12 @@ public class QuestionController : ControllerBase
[Authorize]
[HttpPost]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(StatusCodes.Status201Created)]
[ProducesResponseType(StatusCodes.Status200OK)]
public async Task<IActionResult> AddQuestion(CreateQuestionDto dto, [FromRoute] int surveyId)
{
var model = QuestionMapper.QuestionCreationToModel(dto, surveyId);
await _questionService.AddQuestionAsync(model);
return Created();
var result = QuestionMapper.ModelToQuestionDto(model);
return Ok(result);
}
}