示例#1
0
 public ActionResult MitigationTypeDelete(int id)
 {
     MitigationTypeViewModel vm = new MitigationTypeViewModel();
     vm.MitigationType = db.MitigationTypes.Single(p => p.MitigationTypeId == id);
     return View(vm);
 }
示例#2
0
 public ActionResult MitigationTypeNew(MitigationTypeViewModel vm, int catId)
 {
     if (ModelState.IsValid)
     {
         vm.MitigationType.MitigationCatId = catId;
         db.MitigationTypes.AddObject(vm.MitigationType);
         db.SaveChanges();
         return RedirectToAction("MitigationTypeList", new { catId = catId });
     }
     vm.MitigationCat = db.MitigationCats.Single(p => p.MitigationCatId == catId);
     return View(vm);
 }
示例#3
0
 public ActionResult MitigationTypeList(int catId)
 {
     MitigationTypeViewModel vm = new MitigationTypeViewModel();
     vm.MitigationCat = db.MitigationCats.Single(p => p.MitigationCatId == catId);
     vm.MitigationTypes = db.MitigationTypes.Where(p => p.MitigationCatId == catId);
     ViewBag.CanModify = userData.IsAdmin;
     return View(vm);
 }
示例#4
0
 public ActionResult MitigationTypeNew(int catId)
 {
     MitigationTypeViewModel vm = new MitigationTypeViewModel();
     vm.MitigationCat = db.MitigationCats.Single(p => p.MitigationCatId == catId);
     return View(vm);
 }
示例#5
0
 public ActionResult MitigationTypeEdit(MitigationTypeViewModel vm)
 {
     if (ModelState.IsValid)
     {
         db.MitigationTypes.Attach(vm.MitigationType);
         db.ObjectStateManager.ChangeObjectState(vm.MitigationType, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("MitigationTypeList", new { catId = vm.MitigationType.MitigationCatId });
     }
     return View(vm);
 }