public async Task <CreatedResultAnswerOptionDto> CreateAnswerOption(NewResultAnswerOptionDto newAnswerOptionDto) { ResultAnswerOption answerOption = mapper.Map <ResultAnswerOption>(newAnswerOptionDto); resultAnswerOptionRepository.Insert(answerOption); await unitOfWork.SaveAsync(); return(mapper.Map <CreatedResultAnswerOptionDto>(answerOption)); }
public async Task <DeletedResultAnswerOptionDto> DeleteAnswerOption(int answerOptionId) { ResultAnswerOption answerOption = await resultAnswerOptionRepository.GetByIdAsync(answerOptionId); if (answerOption == null) { return(null); } resultAnswerOptionRepository.Delete(answerOption); await unitOfWork.SaveAsync(); return(mapper.Map <DeletedResultAnswerOptionDto>(answerOption)); }
public async Task <ResultAnswerOptionDetailDto> GetAnswerOptionById(int answerOptionId) { ResultAnswerOption answerOption = await resultAnswerOptionRepository.GetByIdAsync(id : answerOptionId); return(mapper.Map <ResultAnswerOptionDetailDto>(answerOption)); }