public IHttpActionResult PutSocialWorkAttendance(int id, SocialWorkAttendance socialWorkAttendance) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != socialWorkAttendance.SocialWorkAttendanceId) { return BadRequest(); } db.Entry(socialWorkAttendance).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SocialWorkAttendanceExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostSocialWorkAttendance(SocialWorkAttendance socialWorkAttendance) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.SocialWorkAttendances.Add(socialWorkAttendance); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = socialWorkAttendance.SocialWorkAttendanceId }, socialWorkAttendance); }