public ActionResult Index(IContent currentContent)
        {
            var cart = _cartService.LoadCart(_cartService.DefaultCartName);

            var wishlist  = _cartService.LoadCart(_cartService.DefaultWishListName);
            var startPage = _contentLoader.Get <StartPage>(ContentReference.StartPage);

            var viewModel = new NavigationViewModel
            {
                StartPage          = startPage,
                CurrentContentLink = currentContent?.ContentLink,
                UserLinks          = new LinkItemCollection(),
                MiniCart           = _cartViewModelFactory.CreateMiniCartViewModel(cart),
                WishListMiniCart   = _cartViewModelFactory.CreateWishListMiniCartViewModel(wishlist)
            };

            if (HttpContext.User.Identity.IsAuthenticated)
            {
                var rightMenuItems = startPage.RightMenu;
                //if (rightMenuItems != null)
                //{
                //    viewModel.UserLinks.AddRange(rightMenuItems);
                //}

                viewModel.UserLinks.Add(new LinkItem
                {
                    Href = _urlHelper.Action("SignOut", "Login"),
                    Text = _localizationService.GetString("/Header/Account/SignOut")
                });
            }
            else
            {
                viewModel.UserLinks.Add(new LinkItem
                {
                    Href = _urlHelper.Action("Index", "Login", new { returnUrl = currentContent != null ? _urlHelper.ContentUrl(currentContent.ContentLink) : "/" }),
                    Text = _localizationService.GetString("/Header/Account/SignIn")
                });
            }

            return(PartialView(viewModel));
        }
예제 #2
0
        public ActionResult WishListMiniCartDetails()
        {
            var viewModel = _cartViewModelFactory.CreateWishListMiniCartViewModel(WishList);

            return(PartialView("_WishListMiniCartDetails", viewModel));
        }