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