示例#1
0
 public ActionResult RiskGroupDelete(int id)
 {
     RiskGroupViewModel vm = new RiskGroupViewModel();
     vm.RiskGroup = db.RiskGroups.Single(p => p.RiskGroupId == id);
     return View(vm);
 }
示例#2
0
 public ActionResult RiskGroupNew(RiskGroupViewModel vm, int catId)
 {
     if (ModelState.IsValid)
     {
         vm.RiskGroup.RiskCatId = catId;
         db.RiskGroups.AddObject(vm.RiskGroup);
         db.SaveChanges();
         return RedirectToAction("RiskGroupList", new { catId = catId });
     }
     vm.RiskCat = db.RiskCats.Single(p => p.RiskCatId == catId);
     return View(vm);
 }
示例#3
0
 public ActionResult RiskGroupList(int catId)
 {
     RiskGroupViewModel vm = new RiskGroupViewModel();
     vm.RiskCat = db.RiskCats.Single(p => p.RiskCatId == catId);
     ViewBag.CanModify = userData.IsAdmin;
     return View(vm);
 }
示例#4
0
 public ActionResult RiskGroupNew(int catId)
 {
     RiskGroupViewModel vm = new RiskGroupViewModel();
     vm.RiskCat = db.RiskCats.Single(p => p.RiskCatId == catId);
     return View(vm);
 }
示例#5
0
 public ActionResult RiskGroupEdit(RiskGroupViewModel vm)
 {
     if (ModelState.IsValid)
     {
         db.RiskGroups.Attach(vm.RiskGroup);
         db.ObjectStateManager.ChangeObjectState(vm.RiskGroup, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("RiskGroupList", new { catId = vm.RiskGroup.RiskCatId });
     }
     return View(vm);
 }