public ActionResult DeleteConfirmed(int id) /*need to implement cacading delete*/ { CAMPUS_TABLE campus_table = db.CAMPUS_TABLE.Find(id); db.CAMPUS_TABLE.Remove(campus_table); db.SaveChanges(); TempData["notice"] = "The Campus Has Been Successfully Deleted!"; return(RedirectToAction("Index")); }
// // GET: /Campus/Edit/5 public ActionResult Edit(int id = 0) { CAMPUS_TABLE campus_table = db.CAMPUS_TABLE.Find(id); if (campus_table == null) { return(HttpNotFound()); } return(View(campus_table)); }
public ActionResult Edit(CAMPUS_TABLE campus_table) { if (ModelState.IsValid) { db.Entry(campus_table).State = EntityState.Modified; db.SaveChanges(); TempData["notice"] = "The Campus Has Been Successfully Altered!"; return(RedirectToAction("Index")); } return(View(campus_table)); }
public ActionResult Create(CAMPUS_TABLE campus_table) { //reset the id if (ModelState.ContainsKey("CAMPUS_ID")) { ModelState["CAMPUS_ID"].Errors.Clear(); } if (ModelState.IsValid) { db.CAMPUS_TABLE.Add(campus_table); db.SaveChanges(); TempData["notice"] = "New Campus Has Been Successfully registered!"; return(RedirectToAction("Index")); } return(View(campus_table)); }