Esempio n. 1
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PortalMenusModel portalMenusModel = db.PortalMenusModels.Find(id);

            if (portalMenusModel == null)
            {
                return(HttpNotFound());
            }
            PortalMenuViewModel vm = new PortalMenuViewModel();

            vm.menusModel = portalMenusModel;
            IList <SelectListItem> lsItems = Utility.GetRoles();
            SelectListItem         sliAll  = new SelectListItem {
                Value = "All", Text = "All"
            };

            lsItems.Insert(0, sliAll);
            vm.slRoles       = new SelectList(lsItems, "Text", "Text");
            vm.slParentMenus = Utility.GetParentMenus();
            vm.slMenuTypes   = Utility.GetMenuTypes();
            return(View(vm));
        }
Esempio n. 2
0
        public ActionResult Create()
        {
            PortalMenuViewModel vm = new PortalMenuViewModel();

            vm.menusModel = new PortalMenusModel();
            IList <SelectListItem> lsItems = Utility.GetRoles();
            SelectListItem         sliAll  = new SelectListItem {
                Value = "All", Text = "All"
            };

            lsItems.Insert(0, sliAll);
            vm.slRoles       = new SelectList(lsItems, "Text", "Text");
            vm.slParentMenus = Utility.GetParentMenus();
            vm.slMenuTypes   = Utility.GetMenuTypes();
            return(View(vm));
        }
Esempio n. 3
0
        public ActionResult Edit([Bind(Include = "ID,MenuName,ControllerName,ActionName,MenuType,ParentID,Sortorder,RoleName")] PortalMenusModel portalMenusModel)
        {
            if (ModelState.IsValid)
            {
                db.Entry(portalMenusModel).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            PortalMenuViewModel vm = new PortalMenuViewModel();

            vm.menusModel = portalMenusModel;
            IList <SelectListItem> lsItems = Utility.GetRoles();
            SelectListItem         sliAll  = new SelectListItem {
                Value = "All", Text = "All"
            };

            lsItems.Insert(0, sliAll);
            vm.slRoles       = new SelectList(lsItems, "Text", "Text");
            vm.slParentMenus = Utility.GetParentMenus();
            vm.slMenuTypes   = Utility.GetMenuTypes();
            return(View(vm));
        }