コード例 #1
0
        public ActionResult ImpactDetailEdit(int id)
        {
            ImpactDetailViewModel vm = new ImpactDetailViewModel();

            vm.ImpactDetail = db.ImpactDetails.Single(p => p.ImpactDetailId == id);
            return(View(vm));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 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));
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 public ActionResult ImpactDetailEdit(int id)
 {
     ImpactDetailViewModel vm = new ImpactDetailViewModel();
     vm.ImpactDetail = db.ImpactDetails.Single(p => p.ImpactDetailId == id);
     return View(vm);
 }
コード例 #6
0
 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);
 }