public async Task <ActionResult <UpdatedTestQuestionDto> > Put([FromBody] UpdateTestQuestionDto updateTestQuestionDto) { UpdatedTestQuestionDto updatedTestQuestionDto = await testQuestionService.UpdateQuestion(updateTestQuestionDto); if (updatedTestQuestionDto == null) { return(NotFound()); } return(Ok(updatedTestQuestionDto)); }
public async Task <UpdatedTestQuestionDto> UpdateQuestion(UpdateTestQuestionDto updateTestQuestionDto) { TestQuestion testQuestion = await testQuestionRepository.GetByIdAsync(updateTestQuestionDto.Id); if (testQuestion == null) { return(null); } testQuestion = mapper.Map <TestQuestion>(updateTestQuestionDto); testQuestionRepository.Update(testQuestion); await unitOfWork.SaveAsync(); return(mapper.Map <UpdatedTestQuestionDto>(testQuestion)); }