Ejemplo n.º 1
0
        public ActionResult ImpactTypeNew(ImpactTypeViewModel vm, int catId)
        {
            if (ModelState.IsValid)
            {
                vm.ImpactType.ImpactCatId = catId;
                db.ImpactTypes.AddObject(vm.ImpactType);
                db.SaveChanges();

                InsertImpactDetails(vm.ImpactType);

                return RedirectToAction("ImpactTypeList", new { catId = catId });
            }
            vm.ImpactCat = db.ImpactCats.Single(p => p.ImpactCatId == catId);
            return View(vm);
        }
Ejemplo n.º 2
0
 public ActionResult ImpactTypeNew(int catId)
 {
     ImpactTypeViewModel vm = new ImpactTypeViewModel();
     vm.ImpactCat = db.ImpactCats.Single(p => p.ImpactCatId == catId);
     return View(vm);
 }
Ejemplo n.º 3
0
 public ActionResult ImpactTypeEdit(ImpactTypeViewModel vm)
 {
     if (ModelState.IsValid)
     {
         db.ImpactTypes.Attach(vm.ImpactType);
         db.ObjectStateManager.ChangeObjectState(vm.ImpactType, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("ImpactTypeList", new { catId = vm.ImpactType.ImpactCatId });
     }
     return View(vm);
 }
Ejemplo n.º 4
0
 public ActionResult ImpactTypeList(int catId)
 {
     ImpactTypeViewModel vm = new ImpactTypeViewModel();
     vm.ImpactCat = db.ImpactCats.Single(p => p.ImpactCatId == catId);
     vm.ImpactTypes = db.ImpactTypes.Where(p => p.ImpactCatId == catId);
     ViewBag.CanModify = userData.IsAdmin;
     return View(vm);
 }
Ejemplo n.º 5
0
 public ActionResult ImpactTypeEdit(int id)
 {
     ImpactTypeViewModel vm = new ImpactTypeViewModel();
     vm.ImpactType = db.ImpactTypes.Single(p => p.ImpactTypeId == id);
     return View(vm);
 }