Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 3
0
        public async Task <ResultAnswerOptionDetailDto> GetAnswerOptionById(int answerOptionId)
        {
            ResultAnswerOption answerOption = await resultAnswerOptionRepository.GetByIdAsync(id : answerOptionId);

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