예제 #1
0
        public string GetMenuList()
        {
            List <SysMenu> menuList  = new List <SysMenu>();
            var            menuInfos = sysService.GetAllMenu();

            // 父级菜单
            foreach (var item in menuInfos.Where(c => c.ParentId == 0))
            {
                item.Child = new List <SysMenu>();
                foreach (var li in menuInfos.Where(c => c.ParentId == item.Id).OrderBy(c => c.Sort))
                {
                    item.Child.Add(li);
                }

                menuList.Add(item);
            }
            return(menuList.ToJson());
        }