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); }
public ActionResult SubDivNew(int divId) { SubDivViewModel vm = new SubDivViewModel(); vm.Division = db.Divisions.Single(p => p.DivisionId == divId); return View(vm); }
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); }
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); }
public ActionResult SubDivEdit(int id) { SubDivViewModel vm = new SubDivViewModel(); vm.SubDiv = db.SubDivs.Single(p => p.SubDivId == id); return View(vm); }
public ActionResult SubDivDelete(int id) { SubDivViewModel vm = new SubDivViewModel(); vm.SubDiv = db.SubDivs.Include("Division").Single(p => p.SubDivId == id); return View(vm); }