Exemple #1
0
        public async Task <ActionResult <CreatedTestDto> > Post([FromBody] NewTestDto newTestDto)
        {
            if (newTestDto == null)
            {
                return(BadRequest());
            }

            return(Ok(await testService.CreateTest(newTestDto)));
        }
Exemple #2
0
        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));
        }