public ActionResult Create(dbo_protection_programs dbo_protection_programs) { if (ModelState.IsValid) { var db = new qhsedbEntities(); db.dbo_protection_programs.Add(dbo_protection_programs); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(dbo_protection_programs)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var db = new qhsedbEntities(); dbo_protection_programs dbo_protection_programs = db.dbo_protection_programs.Find(id); if (dbo_protection_programs == null) { return(HttpNotFound()); } return(View(dbo_protection_programs)); }
public JsonResult Edit(dbo_protection_programs dbo_protection_programs) { try { var db = new qhsedbEntities(); if (ModelState.IsValid) { dbo_protection_programs.id = dbo_protection_programs.id; db.Entry(dbo_protection_programs).State = EntityState.Modified; // loanRequest.LoanDate = loanRequest.LoanDate; db.SaveChanges(); } return(Json("Edited Protection 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(); dbo_protection_programs dbo_protection_programs = db.dbo_protection_programs.Find(id); if (dbo_protection_programs == null) { return(HttpNotFound()); } var dbo_protection_programsRow = db.dbo_protection_programs.Find(id); db.dbo_protection_programs.Remove(dbo_protection_programsRow); db.SaveChanges(); return(RedirectToAction("Index")); }