コード例 #1
0
        public ActionResult PostRightsManagement(string roleValue, string selectedList)
        {

            UserMenuResponse userMenuRights = menuRightsService.SaveRoleMenuRight(roleValue, selectedList, RoleManager.FindById(roleValue));
            RightsManagementViewModel viewModel = new RightsManagementViewModel();

            viewModel.Roles = userMenuRights.Roles.ToList();
            viewModel.Rights =
                userMenuRights.Menus.Select(
                    m =>
                        new MenuRightModel
                        {
                            MenuId = m.MenuId,
                            MenuTitle = m.MenuTitle,
                            IsParent = m.IsRootItem,
                            IsSelected = userMenuRights.MenuRights.Any(menu => menu.Menu.MenuId == m.MenuId),
                            //ParentId = m.ParentItem != null ? m.ParentItem.MenuId : (int?)null
                        }).ToList();
            viewModel.SelectedRoleId = roleValue;
            return View("RightsManagement", viewModel);

        }
コード例 #2
0
        public ActionResult RightsManagement(FormCollection collection)
        {
            string RoleId = collection.Get("SelectedRoleId");
            UserMenuResponse userMenuRights = menuRightsService.GetRoleMenuRights(RoleId);
            RightsManagementViewModel viewModel = new RightsManagementViewModel();

            viewModel.Roles = userMenuRights.Roles.ToList();
            viewModel.Rights =
                userMenuRights.Menus.Select(
                    m =>
                        new MenuRightModel
                        {
                            MenuId = m.MenuId,
                            MenuTitle = m.MenuTitle,
                            IsParent = m.IsRootItem,
                            IsSelected = userMenuRights.MenuRights.Any(menu => menu.Menu.MenuId == m.MenuId),
                            //ParentId = m.ParentItem != null ? m.ParentItem.MenuId : (int?)null,

                        }).ToList();
            viewModel.SelectedRoleId = RoleId;
            return View(viewModel);
        }
コード例 #3
0
 public ActionResult RightsManagement()
 {
     UserMenuResponse userMenuRights = menuRightsService.GetRoleMenuRights(string.Empty);
     RightsManagementViewModel viewModel = new RightsManagementViewModel();
     viewModel.Roles = userMenuRights.Roles.Where(role => role.Name != "SystemAdministrator").ToList();
     viewModel.Rights =
         userMenuRights.Menus.Select(
             m =>
                 new MenuRightModel
                 {
                     MenuId = m.MenuId,
                     MenuTitle = m.MenuTitle,
                     IsParent = m.IsRootItem,
                     IsSelected = userMenuRights.MenuRights.Any(menu => menu.Menu.MenuId == m.MenuId),
                     //ParentId = m.ParentItem != null ? m.ParentItem.MenuId : (int?)null
                 }).ToList();
     return View(viewModel);
 }