예제 #1
0
        /// <summary>
        /// 获取个人权限列表
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public List <PowerTreeModel> GetUserPowerListJson(int userId)
        {
            var dataAccess          = new MenuData();
            var userPower           = dataAccess.GetPowersById(userId);
            var allMenu             = dataAccess.GetAllMenuListTree();
            var userPowerDictionary = new Dictionary <int, int>();

            if (userPower != null && userPower.Count > 0)
            {
                userPowerDictionary = userPower.ToDictionary(f => f.MenuId, r => r.MenuId);
            }
            return(GetMenuToJObject(allMenu, userPowerDictionary));
        }