예제 #1
0
        /// <summary>
        /// 获取菜单 执行
        /// </summary>
        /// <param name="MenuName"></param>
        /// <returns></returns>
        public List <SystemMenu> GetMenuList(string MenuName)
        {
            List <SystemMenu> _MenuList        = new List <SystemMenu>();
            List <SystemMenu> _MenuList_result = new List <SystemMenu>();


            if (!string.IsNullOrEmpty(MenuName))
            {
                _MenuList = _SystemMenuService.GetWhere(m => m.Title == MenuName).ToList();
            }
            else
            {
                _MenuList = _SystemMenuService.GetAll().ToList();
            }

            foreach (SystemMenu m in _MenuList)
            {
                if (!_MenuList_result.Contains(m))
                {
                    _MenuList_result.Add(m);
                    if (m.Children != null && m.Children.Count > 0)
                    {
                        _MenuList_result.AddRange(m.Children);
                    }
                }
            }
            return(_MenuList_result);
        }