public async Task <ActionResult <CreatedTestDto> > Post([FromBody] NewTestDto newTestDto) { if (newTestDto == null) { return(BadRequest()); } return(Ok(await testService.CreateTest(newTestDto))); }
public async Task <CreatedTestDto> CreateTest(NewTestDto newTestDto) { Test test = mapper.Map <Test>(newTestDto); test.LastModifiedDate = DateTime.Now; testRepository.Insert(test); await unitOfWork.SaveAsync(); return(mapper.Map <CreatedTestDto>(test)); }