Example #1
0
        // GET: RoleMenus/Index
        public ActionResult Index()
        {
            var rolemenus = _roleMenuService.Queryable().Include(r => r.MenuItem).AsQueryable();
            var menus     = _menuItemService.Queryable().Include(x => x.SubMenus).Where(x => x.IsEnabled && x.Parent == null);
            var roles     = _roleManager.Roles;
            var roleview  = new List <RoleView>();

            foreach (var role in roles)
            {
                var      mymenus = _roleMenuService.GetByRoleName(role.Name);
                RoleView r       = new RoleView();
                r.RoleName = role.Name;
                r.Count    = mymenus.Count();
                roleview.Add(r);
            }
            ViewBag.Menus = menus;
            ViewBag.Roles = roleview;
            return(View(rolemenus));
        }