Esempio n. 1
0
        public IList <string> GetMenuListByUserId(int portalId, int userId)
        {
            var all    = _sysRoleRespository.GetMenuList();
            var t      = all.Where(x => x.Portal.Id == portalId).ToList();
            var menus  = _sysRoleRespository.GetMenuListByUserId(portalId, userId);
            var append = menus.Select(x => x.Name).ToList();

            foreach (var m in menus)
            {
                var item = t.First(x => x.Id == m.Id);
                while (item.ParentId != 0)
                {
                    item = t.First(x => x.Id == item.ParentId);
                    append.Add(item.Name);
                }
            }
            return(append.Distinct().ToList());
        }