Ejemplo n.º 1
0
 public ActionResult SubDivNew(SubDivViewModel vm, int divId)
 {
     if (ModelState.IsValid)
     {
         vm.SubDiv.DivisionId = divId;
         db.SubDivs.AddObject(vm.SubDiv);
         db.SaveChanges();
         return RedirectToAction("SubDivList", new { divId = divId });
     }
     vm.Division = db.Divisions.Single(p => p.DivisionId == divId);
     return View(vm);
 }
Ejemplo n.º 2
0
 public ActionResult SubDivNew(int divId)
 {
     SubDivViewModel vm = new SubDivViewModel();
     vm.Division = db.Divisions.Single(p => p.DivisionId == divId);
     return View(vm);
 }
Ejemplo n.º 3
0
 public ActionResult SubDivList(int divId)
 {
     SubDivViewModel vm = new SubDivViewModel();
     vm.Division = db.Divisions.Single(p => p.DivisionId == divId);
     vm.SubDivs = db.SubDivs.Where(p => p.DivisionId == divId).ToList();
     ViewBag.CanModify = userData.IsAdmin;
     return View(vm);
 }
Ejemplo n.º 4
0
 public ActionResult SubDivEdit(SubDiv subDiv)
 {
     if (ModelState.IsValid)
     {
         db.SubDivs.Attach(subDiv);
         db.ObjectStateManager.ChangeObjectState(subDiv, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("SubDivList", new { divId = subDiv.DivisionId });
     }
     SubDivViewModel vm = new SubDivViewModel();
     vm.SubDiv = subDiv;
     return View(vm);
 }
Ejemplo n.º 5
0
 public ActionResult SubDivEdit(int id)
 {
     SubDivViewModel vm = new SubDivViewModel();
     vm.SubDiv = db.SubDivs.Single(p => p.SubDivId == id);
     return View(vm);
 }
Ejemplo n.º 6
0
 public ActionResult SubDivDelete(int id)
 {
     SubDivViewModel vm = new SubDivViewModel();
     vm.SubDiv = db.SubDivs.Include("Division").Single(p => p.SubDivId == id);
     return View(vm);
 }