public IHttpActionResult PutEmployee(Employee employee) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Entry(employee).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(employee.BusinessEntityID)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutDepartment(Department department) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Entry(department).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(department.DepartmentID)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }