public async Task <ActionResult <UpdatedTestQuestionOptionDto> > Put([FromBody] UpdateTestQuestionOptionDto updateQuestionOptionDto) { UpdatedTestQuestionOptionDto updatedQuestionOptionDto = await questionOptionService.UpdateQuestionOption(updateQuestionOptionDto); if (updatedQuestionOptionDto == null) { return(NotFound()); } return(Ok(updatedQuestionOptionDto)); }
public async Task <UpdatedTestQuestionOptionDto> UpdateQuestionOption(UpdateTestQuestionOptionDto updateQuestionOptionDto) { TestQuestionOption questionOption = await questionOptionRepository.GetByIdAsync(updateQuestionOptionDto.Id); if (questionOption == null) { return(null); } questionOption = mapper.Map <TestQuestionOption>(updateQuestionOptionDto); questionOptionRepository.Update(questionOption); await unitOfWork.SaveAsync(); return(mapper.Map <UpdatedTestQuestionOptionDto>(questionOption)); }