示例#1
0
        //
        // GET: /Menu/

        public ActionResult Index(string menuName = "", int moduleId = -1, int status = -1, int pageIndex = 1)
        {
            PageItem pageItem = new PageItem {
                PageIndex = pageIndex, PageSize = 15
            };

            SysModuleLogic   moduleLogic = new SysModuleLogic();
            List <SysModule> moduleList  = moduleLogic.GetModuleList().ToList <SysModule>();

            Dictionary <int, SysModule> dictionaryModule = new Dictionary <int, SysModule>();

            for (int index = 0; index < moduleList.Count; index++)
            {
                dictionaryModule.Add(moduleList[index].ModuleId, moduleList[index]);
            }
            moduleList.Insert(0, new SysModule {
                ModuleId = -1, ModuleName = "全部"
            });
            ViewBag.ModuleId         = new SelectList(moduleList, "ModuleId", "ModuleName");
            ViewBag.DictionaryModule = dictionaryModule;

            List <SysMenu> menuList = logic.GetMenuList(status, menuName, moduleId, pageItem).ToList <SysMenu>();

            ViewBag.MenuList = new PagedList <SysMenu>(menuList, pageItem.PageIndex, pageItem.PageSize, pageItem.TotalCount);
            return(View());
        }
        public ActionResult Index(int roleId = -1)
        {
            ViewBag.CurrentRoleId = roleId;

            SysRoleLogic   roleLogic = new SysRoleLogic();
            List <SysRole> roleList  = roleLogic.GetRoleList().ToList <SysRole>();

            ViewBag.RoleId = new SelectList(roleList, "RoleId", "RoleName");

            List <SysRoleRight> roleRightList = new List <SysRoleRight>();

            if (roleId > 0)
            {
                SysModuleLogic   moduleLogic = new SysModuleLogic();
                List <SysModule> moduleList  = moduleLogic.GetModuleList().ToList <SysModule>();
                ViewBag.ModuleList = moduleList;

                SysMenuLogic   menuLogic = new SysMenuLogic();
                List <SysMenu> menuList  = menuLogic.GetMenuList(0).ToList <SysMenu>();
                ViewBag.MenuList = menuList;

                roleRightList = logic.GetRoleRightList(roleId, false).ToList <SysRoleRight>();
            }

            return(View(roleRightList));
        }