public async Task <IViewComponentResult> InvokeAsync(string NodeAliasPath, int Level, bool LevelIsRelative = true, int MinimumAbsoluteLevel = 2, string CurrentPage = null) { // Use ViewBag to set current Path if (!string.IsNullOrWhiteSpace(CurrentPage)) { if (CurrentPage == "/Home") { // Special case for Home since the Link is just "/" CurrentPage = "/"; } } else { if (PageDataContextRetriever.TryRetrieve(out IPageDataContext <TreeNode> Context)) { CurrentPage = UrlResolver.ResolveUrl(DocumentURLProvider.GetUrl(Context.Page)); } } var AncestorPath = await NavigationRepository.GetAncestorPathAsync(NodeAliasPath, Level, LevelIsRelative, MinimumAbsoluteLevel); var NavItems = await NavigationRepository.GetSecondaryNavItemsAsync(AncestorPath, Enums.PathSelectionEnum.ParentAndChildren); var model = new NavigationViewModel() { NavItems = NavItems.ToList(), CurrentPagePath = CurrentPage }; return(View(model)); }
public async Task <IViewComponentResult> InvokeAsync(string NodeAliasPath, int Level, bool LevelIsRelative = true, int MinimumAbsoluteLevel = 2, string CssClass = null) { // Begin Cache Scope, this is 'ended' in the view CacheDependenciesScope.Begin(); var AncestorPath = await NavigationRepository.GetAncestorPathAsync(NodeAliasPath, Level, LevelIsRelative, MinimumAbsoluteLevel); var NavItems = await NavigationRepository.GetSecondaryNavItemsAsync(AncestorPath, Enums.PathSelectionEnum.ParentAndChildren); var model = new NavigationViewModel() { NavItems = NavItems.ToList(), NavWrapperClass = CssClass, StartingPath = AncestorPath }; return(View(model)); }