public IHttpActionResult PutIncidentTable(int id, IncidentTable incidentTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != incidentTable.id) { return(BadRequest()); } db.Entry(incidentTable).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!IncidentTableExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetIncidentTable(int id) { IncidentTable incidentTable = db.IncidentTables.Find(id); if (incidentTable == null) { return(NotFound()); } return(Ok(incidentTable)); }
public IHttpActionResult PostIncidentTable(IncidentTable incidentTable) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.IncidentTables.Add(incidentTable); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = incidentTable.id }, incidentTable)); }
public IHttpActionResult DeleteIncidentTable(int id) { IncidentTable incidentTable = db.IncidentTables.Find(id); if (incidentTable == null) { return(NotFound()); } db.IncidentTables.Remove(incidentTable); db.SaveChanges(); return(Ok(incidentTable)); }