public IHttpActionResult PutPoliceReported(int id, PoliceReported policeReported) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != policeReported.PoliceReportedId) { return(BadRequest()); } db.Entry(policeReported).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PoliceReportedExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { PoliceReported policeReported = db.PoliceReported.Find(id); db.PoliceReported.Remove(policeReported); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,value")] PoliceReported policeReported) { if (ModelState.IsValid) { db.Entry(policeReported).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(policeReported)); }
public ActionResult Create([Bind(Include = "id,value")] PoliceReported policeReported) { if (ModelState.IsValid) { db.PoliceReported.Add(policeReported); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(policeReported)); }
public IHttpActionResult GetPoliceReported(int id) { PoliceReported policeReported = db.PoliceReporteds.Find(id); if (policeReported == null) { return(NotFound()); } return(Ok(policeReported)); }
public IHttpActionResult PostPoliceReported(PoliceReported policeReported) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PoliceReporteds.Add(policeReported); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = policeReported.PoliceReportedId }, policeReported)); }
// GET: PoliceReporteds/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PoliceReported policeReported = db.PoliceReported.Find(id); if (policeReported == null) { return(HttpNotFound()); } return(View(policeReported)); }
public IHttpActionResult DeletePoliceReported(int id) { PoliceReported policeReported = db.PoliceReporteds.Find(id); if (policeReported == null) { return(NotFound()); } db.PoliceReporteds.Remove(policeReported); db.SaveChanges(); return(Ok(policeReported)); }