public async Task <CreatedTestQuestionDto> CreateQuestion(NewTestQuestionDto newTestQuestionDto) { TestQuestion testQuestion = mapper.Map <TestQuestion>(newTestQuestionDto); testQuestionRepository.Insert(testQuestion); await unitOfWork.SaveAsync(); return(mapper.Map <CreatedTestQuestionDto>(testQuestion)); }
public async Task <ActionResult <CreatedTestQuestionDto> > Post([FromBody] NewTestQuestionDto newTestQuestionDto) { if (newTestQuestionDto == null) { return(BadRequest()); } return(Ok(await testQuestionService.CreateQuestion(newTestQuestionDto))); }