public ActionResult Create(emerg_rescue_plan emerg_rescue_plan) { if (ModelState.IsValid) { var db = new qhsedbEntities(); db.emerg_rescue_plan.Add(emerg_rescue_plan); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(emerg_rescue_plan)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var db = new qhsedbEntities(); emerg_rescue_plan emerg_rescue_plan = db.emerg_rescue_plan.Find(id); if (emerg_rescue_plan == null) { return(HttpNotFound()); } return(View(emerg_rescue_plan)); }
public JsonResult Edit(emerg_rescue_plan emerg_rescue_plan) { try { var db = new qhsedbEntities(); if (ModelState.IsValid) { emerg_rescue_plan.id = emerg_rescue_plan.id; db.Entry(emerg_rescue_plan).State = EntityState.Modified; // loanRequest.LoanDate = loanRequest.LoanDate; db.SaveChanges(); } return(Json("Edited Emergency Rescue System", JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(e.Message, JsonRequestBehavior.AllowGet)); } }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var db = new qhsedbEntities(); emerg_rescue_plan emerg_rescue_plan = db.emerg_rescue_plan.Find(id); if (emerg_rescue_plan == null) { return(HttpNotFound()); } var emerg_rescue_planRow = db.emerg_rescue_plan.Find(id); db.emerg_rescue_plan.Remove(emerg_rescue_planRow); db.SaveChanges(); return(RedirectToAction("Index")); }