public ActionResult RiskGroupDelete(int id) { RiskGroupViewModel vm = new RiskGroupViewModel(); vm.RiskGroup = db.RiskGroups.Single(p => p.RiskGroupId == id); return View(vm); }
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); }
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); }
public ActionResult RiskGroupNew(int catId) { RiskGroupViewModel vm = new RiskGroupViewModel(); vm.RiskCat = db.RiskCats.Single(p => p.RiskCatId == catId); return View(vm); }
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); }