コード例 #1
0
        private async Task <object> GetMenuButtonList()
        {
            var roleId           = User.Claims.First(t => t.Type == OperatorModelClaimNames.RoleId).Value;
            var authedButtonList = await menuButtonApp.GetButtonListByRoleId(roleId);

            var distinctAuthedMenuButtonList       = authedButtonList.Distinct(new ExtList <MenuButtonEntity>("MenuId"));
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            foreach (MenuButtonEntity item in distinctAuthedMenuButtonList)
            {
                var buttonList = authedButtonList.Where(t => t.MenuId.Equals(item.MenuId));
                dictionary.Add(item.MenuId, buttonList);
            }
            return(dictionary);
        }
コード例 #2
0
        private async Task <object> GetMenuButtonList()
        {
            var roleClaim = User.Claims.FirstOrDefault(t => t.Type == OperatorModelClaimNames.RoleId);

            if (roleClaim == null)
            {
                return(null);
            }
            var roleId           = roleClaim.Value;
            var isSystem         = User.Claims.First(t => t.Type == OperatorModelClaimNames.IsSystem).Value;
            var authedButtonList = await menuButtonApp.GetButtonListByRoleId(roleId, isSystem.ToBool(), this.TenantId);

            var distinctAuthedMenuButtonList       = authedButtonList.Distinct(new ExtList <MenuButtonEntity>("MenuId"));
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            foreach (MenuButtonEntity item in distinctAuthedMenuButtonList)
            {
                var buttonList = authedButtonList.Where(t => t.MenuId.Equals(item.MenuId));
                dictionary.Add(item.MenuId, buttonList);
            }
            return(dictionary);
        }