コード例 #1
0
        public async Task <CreatedResultAnswerOptionDto> CreateAnswerOption(NewResultAnswerOptionDto newAnswerOptionDto)
        {
            ResultAnswerOption answerOption = mapper.Map <ResultAnswerOption>(newAnswerOptionDto);

            resultAnswerOptionRepository.Insert(answerOption);
            await unitOfWork.SaveAsync();

            return(mapper.Map <CreatedResultAnswerOptionDto>(answerOption));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        public async Task <ResultAnswerOptionDetailDto> GetAnswerOptionById(int answerOptionId)
        {
            ResultAnswerOption answerOption = await resultAnswerOptionRepository.GetByIdAsync(id : answerOptionId);

            return(mapper.Map <ResultAnswerOptionDetailDto>(answerOption));
        }