public async Task <IHttpActionResult> PutDepartment(int id, Department department) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != department.DepartmentID) { return(BadRequest()); } db.Entry(department).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartmentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PutUserLogin(int id, UserLogin userLogin) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != userLogin.UserLoginID) { return(BadRequest()); } db.Entry(userLogin).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserLoginExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PutLeaveType(int id, LeaveType leaveType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != leaveType.LeaveTypeID) { return(BadRequest()); } db.Entry(leaveType).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LeaveTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }