public async Task <IActionResult> PutProject(int id, Project project) { if (id != project.Id) { return(BadRequest()); } _context.Entry(project).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProjectExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ProjectModel> Add(ProjectModel apiModel) { _context.Projects.Add(apiModel.ToDbModel()); await _context.SaveChangesAsync(); return(apiModel); }