public IHttpActionResult PostClientShiftAssignment(ClientShiftAssignment clientShiftAssignment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ClientShiftAssignments.Add(clientShiftAssignment); try { db.SaveChanges(); } catch (DbUpdateException) { if (ClientShiftAssignmentExists(clientShiftAssignment.ClientId)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = clientShiftAssignment.ClientId }, clientShiftAssignment)); }
public IHttpActionResult PutClientShiftAssignment(int id, ClientShiftAssignment clientShiftAssignment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != clientShiftAssignment.ClientId) { return(BadRequest()); } db.Entry(clientShiftAssignment).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ClientShiftAssignmentExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetClientShiftAssignment(int id) { ClientShiftAssignment clientShiftAssignment = db.ClientShiftAssignments.Find(id); if (clientShiftAssignment == null) { return(NotFound()); } return(Ok(clientShiftAssignment)); }
public IHttpActionResult DeleteClientShiftAssignment(int id) { ClientShiftAssignment clientShiftAssignment = db.ClientShiftAssignments.Find(id); if (clientShiftAssignment == null) { return(NotFound()); } db.ClientShiftAssignments.Remove(clientShiftAssignment); db.SaveChanges(); return(Ok(clientShiftAssignment)); }