public async Task <ProjectModel> Create(string projectRaw) { ProjectModel project; try { project = JsonConvert.DeserializeObject <ProjectModel>(projectRaw); } catch { throw new BadRequestException("Bad request"); } _projectValidator.ValidatePostProject(project); var projectDTO = _mapper.Map <ProjectModel, Project>(project); projectDTO.createdDate = DateTime.Now; projectDTO.lastModifiedDate = DateTime.Now; _apiContext.Project.Add(projectDTO); await _apiContext.SaveChangesAsync(); var createdProject = await Get(projectDTO.id); return(createdProject); }