public IHttpActionResult PutIncident_Patrol(int id, Incident_Patrol incident_Patrol) { db.Configuration.ProxyCreationEnabled = false; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != incident_Patrol.Incident_ID) { return(BadRequest()); } db.Entry(incident_Patrol).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Incident_PatrolExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostIncident_Patrol(Incident_Patrol incident_Patrol) { db.Configuration.ProxyCreationEnabled = false; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Incident_Patrol.Add(incident_Patrol); try { db.SaveChanges(); } catch (DbUpdateException) { if (Incident_PatrolExists(incident_Patrol.Incident_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = incident_Patrol.Incident_ID }, incident_Patrol)); }
public IHttpActionResult GetIncident_Patrol(int id) { db.Configuration.ProxyCreationEnabled = false; Incident_Patrol incident_Patrol = db.Incident_Patrol.Find(id); if (incident_Patrol == null) { return(NotFound()); } return(Ok(incident_Patrol)); }
public IHttpActionResult DeleteIncident_Patrol(int id) { db.Configuration.ProxyCreationEnabled = false; Incident_Patrol incident_Patrol = db.Incident_Patrol.Find(id); if (incident_Patrol == null) { return(NotFound()); } db.Incident_Patrol.Remove(incident_Patrol); db.SaveChanges(); return(Ok(incident_Patrol)); }