public List <MenusOut> GetMenusList() { List <SysMenus> dataAll = _sysMenusRepository.GetAllList(); //转换数据集合的关系格式 dataAll = _sysMenusRepository.ConvertMenusByChildrenList(dataAll); return(ObjectMapper.Map <List <MenusOut> >(dataAll)); }
public void CreateMenuItemDefinition(MenuDefinition menuDefinition) { //获取所有模块 List <SysMenus> data = _menusRepository.GetAllList().Where(p => p.IsActive == true).ToList(); //转换模块数据格式,转换成子父节点包含的形式 data = _sysMenusRepository.ConvertMenusByChildrenList(data); foreach (SysMenus item in data) { MenuItemDefinition menuItemDefinition = new MenuItemDefinition( name: item.MenuName, //displayName: item.MenuDisplayName.L(), displayName: GetMenuLocalizable(item.MenuDisplayName), icon: item.Icon, url: item.Url, requiresAuthentication: item.IsRequiresAuth, requiredPermissionName: item.PermissionName, customData: null, order: Convert.ToInt32(item.OrderBy) ); SetChildrenMenusNavigation(menuItemDefinition, item); menuDefinition.AddItem(menuItemDefinition); } }