public ActionResult Index(int rgid = 0, int rid = 0, int id = 0)
        {
            AddPermissionsViewModels model = new AddPermissionsViewModels();

            model.Permission            = new PagePermissions();
            model.Permission.MenuItemId = rid;
            model.GroupId            = rgid;
            model.MenuItemId         = rid;
            model.MenuItemsGroupList = _menuItemsService.GetAllGroups();
            if (rid > 0)
            {
                var pList = _pagePermissionsService.GetAllPermissionsByResourceId(rid);
                model.PermissionsList = pList == null ? new List <PagePermissions>() : pList.ToList();
            }
            var rList = _menuItemsService.GetAllResourcesByGroupId(rgid);

            model.MenuItemsList = rList == null ? new List <MenuItemsListViewModels>() : rList.ToList();
            if (id > 0)
            {
                var permission = _pagePermissionsService.QueryableCustom().Where(w => w.PagePermissionId == id && w.IsActive).FirstOrDefault();
                model.Permission   = permission == null?new PagePermissions(): permission;
                model.PermissionId = model.Permission.PermissionId;
            }
            return(View(model));
        }
Beispiel #2
0
        public ActionResult Index(int id = 0, int rid = 0)
        {
            MenuItemsViewModels model = new MenuItemsViewModels();

            model.MenuItemsGroupList = _menuItemsService.GetAllGroups();
            if (id > 0)
            {
                model.MenuItem = _menuItemsService.Find(id).data;
            }
            else
            {
                model.MenuItem         = new MenuItems();
                model.MenuItem.GroupId = rid;
            }
            if (rid > 0)
            {
                model.MenuItemsList = _menuItemsService.GetAllResourcesByGroupId(rid);
            }
            else
            {
                model.MenuItemsList = _menuItemsService.GetAllResourcesByGroupId();
            }
            return(View(model));
        }