public ActionResult DeleteSituation(int id) { Models.Situation model = _db.Situation.Find(id); _db.Situation.Remove(model); _db.SaveChanges(); return(RedirectToAction("Situatie")); }
//Edit public ActionResult EditSituation(int id) { Models.Situation model = _db.Situation.Find(id); if (model == null) { return(HttpNotFound()); } return(View(model)); }
public ActionResult EditSituation(Models.Situation model) { if (ModelState.IsValid) { _db.Entry(model).State = EntityState.Modified; _db.SaveChanges(); return(RedirectToAction("Situatie")); } return(View(model)); }
public ActionResult CreateSituation(Models.Situation model) { if (ModelState.IsValid) { _db.Situation.Add(model); _db.SaveChanges(); return(RedirectToAction("Situatie")); } return(View(model)); }
//Delete public ActionResult DeleteSituation(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Models.Situation model = _db.Situation.Find(id); if (model == null) { return(HttpNotFound()); } return(View(model)); }