update question

This commit is contained in:
Вячеслав 2025-05-13 19:19:43 +05:00
parent 9555497d4e
commit 7cbff22d8a
3 changed files with 45 additions and 0 deletions

View file

@ -56,6 +56,17 @@ public class QuestionController : ControllerBase
return Ok(result);
}
[Authorize]
[HttpPut("{id}")]
public async Task<IActionResult> UpdateQuestion([FromBody] QuestionUpdateDto dto, [FromRoute] int id,
[FromRoute] int surveyId)
{
var question = QuestionMapper.QuestionUpdateToModel(dto, surveyId, id);
await _questionService.UpdateQuestionAsync(question);
var result = QuestionMapper.ModelToQuestionDto(question);
return Ok(result);
}
[Authorize]
[HttpDelete("{id}")]
public async Task<IActionResult> DeleteQuestion([FromRoute] int id, [FromRoute] int surveyId)