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