public IHttpActionResult PutIncident_Image(int id, Incident_Image incident_Image) { db.Configuration.ProxyCreationEnabled = false; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != incident_Image.Patrol_Log_ID) { return(BadRequest()); } db.Entry(incident_Image).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Incident_ImageExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostIncident_Image(Incident_Image incident_Image) { db.Configuration.ProxyCreationEnabled = false; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Incident_Image.Add(incident_Image); try { db.SaveChanges(); } catch (DbUpdateException) { if (Incident_ImageExists(incident_Image.Incident_Image_ID)) { return(Conflict()); } else { return(BadRequest("Photo could not be uploaded")); } } return(CreatedAtRoute("DefaultApi", new { id = incident_Image.Incident_Image_ID }, incident_Image)); }
public IHttpActionResult GetIncident_Image(int id) { db.Configuration.ProxyCreationEnabled = false; Incident_Image incident_Image = db.Incident_Image.Find(id); if (incident_Image == null) { return(NotFound()); } return(Ok(incident_Image)); }
public IHttpActionResult DeleteIncident_Image(int id) { db.Configuration.ProxyCreationEnabled = false; Incident_Image incident_Image = db.Incident_Image.Find(id); if (incident_Image == null) { return(NotFound()); } db.Incident_Image.Remove(incident_Image); db.SaveChanges(); return(Ok(incident_Image)); }