public ActionResult WishListInHeader() { var vm = new WishListViewModel { Url = WishListUrlProvider.GetWishListUrl(new GetWishListUrlParam { CultureInfo = ComposerContext.CultureInfo, BaseUrl = RequestUtils.GetBaseUrl(Request).ToString() }) }; vm.Context.Add("IsAuthenticated", ComposerContext.IsAuthenticated); return(View("WishListInHeader", vm)); }
public virtual MenuViewModel CreateMenu(string currentUrl) { var urlParam = new BaseUrlParameter { CultureInfo = ComposerContext.CultureInfo }; bool recurringOrderConfigEnabled = RecurringOrdersSettings.Enabled; var myAccountUrl = MyAccountUrlProvider.GetMyAccountUrl(urlParam); var addressListUrl = MyAccountUrlProvider.GetAddressListUrl(urlParam); var myOrderHistoryUrl = OrderUrlProvider.GetOrderHistoryUrl(new GetOrderUrlParameter { CultureInfo = ComposerContext.CultureInfo }); var myWishListUrl = WishListUrlProvider.GetWishListUrl(new GetWishListUrlParam { CultureInfo = ComposerContext.CultureInfo }); var myRecurringScheduleUrl = RecurringScheduleUrlProvider.GetRecurringScheduleUrl(new GetRecurringScheduleUrlParam { CultureInfo = ComposerContext.CultureInfo }); var currentPageId = new Guid(currentUrl); var menu = new MenuViewModel { MenuItems = new List <MenuItemViewModel>() }; var pageConfiguration = SiteConfiguration.GetPagesConfiguration(ComposerContext.CultureInfo, WebsiteContext.WebsiteId); var myAccountPage = PageService.GetPage(pageConfiguration.MyAccountPageId, ComposerContext.CultureInfo); var myAddressPage = PageService.GetPage(pageConfiguration.AddressListPageId, ComposerContext.CultureInfo); var myOrderHistoryPage = PageService.GetPage(pageConfiguration.OrderHistoryPageId, ComposerContext.CultureInfo); var myWishListage = PageService.GetPage(pageConfiguration.MyWishListPageId, ComposerContext.CultureInfo); var myRecurringSchedulePage = PageService.GetPage(RecurringOrdersSettings.RecurringSchedulePageId, ComposerContext.CultureInfo); var myAccountMenuItem = new MenuItemViewModel { Name = myAccountPage.MenuTitle, Url = myAccountUrl, IsActive = currentPageId == pageConfiguration.MyAccountPageId || currentPageId == pageConfiguration.ChangePasswordPageId }; var myAdressesMenuItem = new MenuItemViewModel { Name = myAddressPage.MenuTitle, Url = addressListUrl, IsActive = currentPageId == pageConfiguration.AddressListPageId || currentPageId == pageConfiguration.AddAddressPageId || currentPageId == pageConfiguration.UpdateAddressPageId }; var myWishListMenuItem = new MenuItemViewModel { Name = myWishListage.MenuTitle, Url = myWishListUrl, IsActive = currentPageId == pageConfiguration.MyWishListPageId }; var myOrderHistoryMenuItem = new MenuItemViewModel { Name = myOrderHistoryPage.MenuTitle, Url = myOrderHistoryUrl, IsActive = currentPageId == pageConfiguration.OrderHistoryPageId || currentPageId == pageConfiguration.OrderDetailsPageId || currentPageId == RecurringOrdersSettings.RecurringCartDetailsPageId }; var myRecurringScheduleMenuItem = new MenuItemViewModel { Name = myRecurringSchedulePage.MenuTitle, Url = myRecurringScheduleUrl, IsActive = currentPageId == RecurringOrdersSettings.RecurringSchedulePageId || currentPageId == RecurringOrdersSettings.RecurringScheduleDetailsPageId }; menu.MenuItems.AddRange(new List <MenuItemViewModel> { myAccountMenuItem, myWishListMenuItem, myAdressesMenuItem, myOrderHistoryMenuItem }); if (recurringOrderConfigEnabled) { menu.MenuItems.Add(myRecurringScheduleMenuItem); } return(menu); }