public async Task <IActionResult> Menu() { var menuSelectData = new Dictionary <int, string>(); var menuList = await _menuInfoRepository.Query(x => x.MenuLevel == 1 || x.MenuLevel == 2, x => x.OrderFlag); foreach (var item in menuList) { if (item.ParentId == 0) { menuSelectData.Add(item.Id, item.MenuName); } else { var parentMenu = await _menuInfoRepository.QueryById(item.ParentId); menuSelectData.Add(item.Id, parentMenu.MenuName + ">>" + item.MenuName); } } return(View(menuSelectData)); }
public async Task <List <MenuInfo> > GetMenus(string menuIds) { List <MenuInfo> menuInfos = new List <MenuInfo>(); string[] arr = menuIds.Split(','); if (arr.Length > 0) { for (int i = 0; i < arr.Length; i++) { var tmpData = await _mneuInfoRepository.QueryById(arr[i]); if (tmpData != null) { menuInfos.Add(tmpData); } } } return(menuInfos); }