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 ActionResult TabParent() { var CurrentTabParentPage = PageDataContextRetriever.Retrieve <TabParent>().Page; // Get child tabs to render var ChildTabs = PageRetriever.Retrieve <Tab>(query => query.Path(CurrentTabParentPage.NodeAliasPath, PathTypeEnum.Children) ).Select(x => new TabFields(x)); TabParentViewModel model = new TabParentViewModel() { Tabs = ChildTabs }; return(View(model)); }
public async Task <ActionResult> GetFileGeneric() { var PageContext = PageDataContextRetriever.Retrieve <TreeNode>(); if (PageContext.Page != null && PageContext.Page.Attachments.Count > 0) { var Attachment = await AttachmentInfoProvider.GetAsync(PageContext.Page.Attachments.FirstItem.AttachmentGUID, SiteService.CurrentSite.SiteID); if (Attachment != null) { return(new FileStreamResult(new MemoryStream(Attachment.AttachmentBinary), Attachment.AttachmentMimeType) { FileDownloadName = Attachment.AttachmentName }); } } return(NotFound()); }
public async Task <IViewComponentResult> InvokeAsync(bool IncludeDefaultBreadcrumb = true, int Nodeid = -1) { // Use current page if not provided if (Nodeid <= 0) { if (PageDataContextRetriever.TryRetrieve(out IPageDataContext <TreeNode> Context)) { Nodeid = Context.Page.NodeID; } } if (Nodeid <= 0) { return(Content(string.Empty)); } var model = await BreadcrumbRepository.GetBreadcrumbsAsync(Nodeid, IncludeDefaultBreadcrumb); return(View(model)); }
public async Task <IViewComponentResult> InvokeAsync(bool IncludeDefaultBreadcrumb = true, int Nodeid = -1) { // Use current page if not provided if (Nodeid <= 0) { if (PageDataContextRetriever.TryRetrieve(out IPageDataContext <TreeNode> Context)) { Nodeid = Context.Page.NodeID; } } if (Nodeid <= 0) { return(Content(string.Empty)); } var breadcrumbs = await BreadcrumbRepository.GetBreadcrumbsAsync(Nodeid, IncludeDefaultBreadcrumb); var model = await BreadcrumbRepository.BreadcrumbsToJsonLDAsync(breadcrumbs, !IncludeDefaultBreadcrumb); // Serialize into the raw JSON data model.JsonData = JsonConvert.SerializeObject(model); return(View(model)); }