コード例 #1
0
 public ActionResult DeleteSituation(int id)
 {
     Models.Situation model = _db.Situation.Find(id);
     _db.Situation.Remove(model);
     _db.SaveChanges();
     return(RedirectToAction("Situatie"));
 }
コード例 #2
0
 //Edit
 public ActionResult EditSituation(int id)
 {
     Models.Situation model = _db.Situation.Find(id);
     if (model == null)
     {
         return(HttpNotFound());
     }
     return(View(model));
 }
コード例 #3
0
 public ActionResult EditSituation(Models.Situation model)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(model).State = EntityState.Modified;
         _db.SaveChanges();
         return(RedirectToAction("Situatie"));
     }
     return(View(model));
 }
コード例 #4
0
 public ActionResult CreateSituation(Models.Situation model)
 {
     if (ModelState.IsValid)
     {
         _db.Situation.Add(model);
         _db.SaveChanges();
         return(RedirectToAction("Situatie"));
     }
     return(View(model));
 }
コード例 #5
0
 //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));
 }