public ActionResult ImpactDetailEdit(int id) { ImpactDetailViewModel vm = new ImpactDetailViewModel(); vm.ImpactDetail = db.ImpactDetails.Single(p => p.ImpactDetailId == id); return(View(vm)); }
public ActionResult ImpactDetailList(int typeId) { ImpactDetailViewModel vm = new ImpactDetailViewModel(); vm.ImpactType = db.ImpactTypes.Single(p => p.ImpactTypeId == typeId); vm.ImpactDetails = db.ImpactDetails.Where(p => p.ImpactTypeId == typeId); ViewBag.CanModify = userData.IsAdmin; return(View(vm)); }
public ActionResult ImpactDetailEdit(ImpactDetailViewModel vm) { if (ModelState.IsValid) { db.ImpactDetails.Attach(vm.ImpactDetail); db.Entry(vm.ImpactDetail).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ImpactDetailList", new { typeId = vm.ImpactDetail.ImpactTypeId })); } return(View(vm)); }
public ActionResult ImpactDetailEdit(ImpactDetailViewModel vm) { if (ModelState.IsValid) { db.ImpactDetails.Attach(vm.ImpactDetail); db.ObjectStateManager.ChangeObjectState(vm.ImpactDetail, EntityState.Modified); db.SaveChanges(); return RedirectToAction("ImpactDetailList", new { typeId = vm.ImpactDetail.ImpactTypeId }); } return View(vm); }
public ActionResult ImpactDetailEdit(int id) { ImpactDetailViewModel vm = new ImpactDetailViewModel(); vm.ImpactDetail = db.ImpactDetails.Single(p => p.ImpactDetailId == id); return View(vm); }
public ActionResult ImpactDetailList(int typeId) { ImpactDetailViewModel vm = new ImpactDetailViewModel(); vm.ImpactType = db.ImpactTypes.Single(p => p.ImpactTypeId == typeId); vm.ImpactDetails = db.ImpactDetails.Where(p => p.ImpactTypeId == typeId); ViewBag.CanModify = userData.IsAdmin; return View(vm); }