public async Task <IHttpActionResult> Create(Project project) { if (!ModelState.IsValid) { return(BadRequest()); } projectRepository.Create(project); await db.SaveChangesAsync(); return(Ok()); }
public async Task <IHttpActionResult> Create([FromBody] ConsultantAddDto consultantAddDto) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (consultantAddDto.UserAddDto == null) { return(BadRequest("User can not be null")); } consultantRepository.Create(consultantAddDto.ConsultantAddDtoToConsultant()); await db.SaveChangesAsync(); return(Ok()); }
public async Task <IHttpActionResult> Create(ManagerAddDto managerAddDto) { if (!ModelState.IsValid) { return(BadRequest()); } if (managerAddDto.UserAddDto == null) { return(BadRequest("User can not be null")); } managerRepository.Create(managerAddDto.ManagerAddDtoToManager()); await db.SaveChangesAsync(); return(Ok()); }
public async Task <IHttpActionResult> Create(ProjectManager projectManager) { if (!ModelState.IsValid) { return(BadRequest()); } if (projectManager.User == null) { return(BadRequest("User can not be null")); } userRepository.Create(projectManager.User); projectManagerRepository.Create(projectManager); await db.SaveChangesAsync(); return(Ok()); }