public IActionResult Index() { string userId = _httpContextAccessor.HttpContext.Request.Cookies["UserId"]; GetDashboardMenuResponse response = _dashboardService.GetDashboardMenu(Convert.ToInt32(userId)); GetDashboardMenuResponse response2 = new GetDashboardMenuResponse(); response2.ErrorMessage = response.ErrorMessage; response2.isSuccess = response.isSuccess; List <GetDashboardMenu> GetMenuList = new List <GetDashboardMenu>(); foreach (var item in response.GetDashboardMenuList) { GetDashboardMenu menuItem = new GetDashboardMenu(); menuItem.MenuId = item.MenuId; menuItem.MenuItemClass = item.MenuItemClass; menuItem.MenuItemDescription = item.MenuItemDescription; menuItem.MenuItemIcon = item.MenuItemIcon; menuItem.MenuItemId = item.MenuItemId; menuItem.MenuItemOrderNo = item.MenuItemOrderNo; menuItem.MenuItemUrl = item.MenuItemUrl; menuItem.MenuItemUrlLocalhost = item.MenuItemUrlLocalhost; if (item.MenuItemValueForProjects == "UIAnasayfa") { menuItem.MenuItemName = _localizer["UIAnasayfa"]; } else if (item.MenuItemValueForProjects == "UISSHService" || item.MenuItemValueForProjects == "UISSHAdmin" || item.MenuItemValueForProjects == "UISSHAdminYedekParca") { menuItem.MenuItemName = _localizer["UISSH"]; } else if (item.MenuItemValueForProjects == "UIFazlaMesai") { menuItem.MenuItemName = _localizer["UIFazlaMesai"]; } else if (item.MenuItemValueForProjects == "UIMes") { menuItem.MenuItemName = _localizer["UIMes"]; } else if (item.MenuItemValueForProjects == "UICustomerPortal") { menuItem.MenuItemName = _localizer["UICustomerPortal"]; } GetMenuList.Add(menuItem); } response2.GetDashboardMenuList = GetMenuList; ViewBag.UserName = _httpContextAccessor.HttpContext.Request.Cookies["UserName"]; if (response != null) { return(View(response2)); } else { return(View()); } }
public GetDashboardMenuResponse GetACSAdminMenu(int UserId) { GetDashboardMenuResponse response = new GetDashboardMenuResponse(); List <GetDashboardMenu> homeMenu = new List <GetDashboardMenu>(); var userMenu = from menuItem in context.TblMenuItemsRepository.Get() join userMenuItems in context.TblUserMenuItemRepository.Get() on menuItem.MenuItemId equals userMenuItems.MenuItemId where menuItem.MenuValueForProjects == "SSHAdmin" && userMenuItems.UserId == UserId select new { menuItem.MenuItemName, menuItem.MenuItemOrderNo, menuItem.MenuItemUrl, menuItem.MenuItemIcon, menuItem.MenuItemId, menuItem.MenuItemUrlLocalhost, menuItem.MenuItemValueForProjects } into selection orderby selection.MenuItemOrderNo ascending select selection; if (userMenu != null) { foreach (var item in userMenu) { GetDashboardMenu menu = new GetDashboardMenu(); menu.MenuItemName = item.MenuItemName; menu.MenuItemUrl = item.MenuItemUrl; menu.MenuItemIcon = item.MenuItemIcon; menu.MenuItemId = item.MenuItemId; menu.MenuItemUrlLocalhost = item.MenuItemUrlLocalhost; menu.MenuItemValueForProjects = item.MenuItemValueForProjects; homeMenu.Add(menu); } response.isSuccess = true; response.GetDashboardMenuList = homeMenu; } else { response.isSuccess = false; } return(response); }