Ejemplo n.º 1
0
        public async Task <CreatedTestQuestionDto> CreateQuestion(NewTestQuestionDto newTestQuestionDto)
        {
            TestQuestion testQuestion = mapper.Map <TestQuestion>(newTestQuestionDto);

            testQuestionRepository.Insert(testQuestion);
            await unitOfWork.SaveAsync();

            return(mapper.Map <CreatedTestQuestionDto>(testQuestion));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <CreatedTestQuestionDto> > Post([FromBody] NewTestQuestionDto newTestQuestionDto)
        {
            if (newTestQuestionDto == null)
            {
                return(BadRequest());
            }

            return(Ok(await testQuestionService.CreateQuestion(newTestQuestionDto)));
        }