public ActionResult MitigationTypeDelete(int id) { MitigationTypeViewModel vm = new MitigationTypeViewModel(); vm.MitigationType = db.MitigationTypes.Single(p => p.MitigationTypeId == id); return View(vm); }
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); }
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); }
public ActionResult MitigationTypeNew(int catId) { MitigationTypeViewModel vm = new MitigationTypeViewModel(); vm.MitigationCat = db.MitigationCats.Single(p => p.MitigationCatId == catId); return View(vm); }
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); }