示例#1
0
        public ActionResult Index(IContent currentContent)
        {
            var startPage = _contentLoader.Get <StartPage>(ContentReference.StartPage);

            var viewModel = new NavigationViewModel
            {
                StartPage          = startPage,
                CurrentContentLink = currentContent?.ContentLink,
                UserLinks          = new LinkItemCollection()
            };

            var organization = _organizationService.GetCurrentUserOrganization();

            if (organization == null)
            {
                return(PartialView(viewModel));
            }

            if (startPage.B2BMenu != null)
            {
                viewModel.UserLinks.AddRange(_b2bNavigationService.FilterB2BNavigationForCurrentUser(startPage.B2BMenu));
            }

            return(PartialView(viewModel));
        }
        public IViewComponentResult Invoke(IContent currentContent)
        {
            var startPage      = _contentLoader.Get <HomePage>(ContentReference.StartPage);
            var layoutSettings = _settingsService.GetSiteSettings <LayoutSettings>();
            var viewModel      = new B2BNavigationViewModel
            {
                StartPage          = startPage,
                CurrentContentLink = currentContent?.ContentLink,
                CurrentContentGuid = currentContent?.ContentGuid ?? Guid.Empty,
                UserLinks          = new LinkItemCollection()
            };

            var organization = _organizationService.GetCurrentFoundationOrganization();

            if (organization == null)
            {
                return(View("_B2BNavigation.cshtml", viewModel));
            }

            if (layoutSettings?.OrganizationMenu != null)
            {
                viewModel.UserLinks.AddRange(_b2bNavigationService.FilterB2BNavigationForCurrentUser(layoutSettings.OrganizationMenu));
            }

            return(View("_B2BNavigation.cshtml", viewModel));
        }