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