// // GET: /Regions/Create public ActionResult Create(long?parent) { if (!User.IsInRole(db, RoleEnum.Admin, parent)) { return(RedirectToAction("Login", "Account", new { returnUrl = Url.Action("Create", "Regions", new { parent = parent }) })); } var regList = proc.GetAdministartorRegion(User.GetDbUser(db), parent); ViewBag.Regions = regList; var model = new RegionEditModel { IidParent = parent }; model.LoadUsers(db); return(View("Edit", model)); }
public ActionResult Edit(long id) { var model = db.Regions.Find(id); if (model == null) { return(HttpNotFound()); } if (!User.IsInRole(db, RoleEnum.Admin, model.IidParent)) { return(RedirectToAction("Login", "Account", new { returnUrl = Url.Action("Edit", "Regions", new { id = id }) })); } ViewBag.Regions = proc.GetAdministartorRegion(User.GetDbUser(db), model.IidParent); var editModel = new RegionEditModel(model); editModel.LoadUsers(db); return(View(editModel)); }