public IHttpActionResult PostAttendance(int id, Attendance attendance) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != attendance.ID) { return(BadRequest()); } bool result = repository.Edit(attendance); if (!result) { return(BadRequest()); } attendance = repository.GetById(id); return(Content(HttpStatusCode.OK, attendance)); }