public override ActionResult Index(ListingBlock currentBlock) { var _loader = ServiceLocator.Current.GetInstance <IContentLoader>(); ListingBlockViewModel viewmodel = new ListingBlockViewModel(); viewmodel.Heading = currentBlock.Heading; var pages = _loader.GetChildren <PageData>(currentBlock.Parent); var filteredChildren = FilterForVisitor.Filter(pages).Cast <PageData>(); viewmodel.Pages = filteredChildren; return(PartialView(viewmodel)); }
public override ActionResult Index(ListingBlock currentBlock) { var viewModel = new ListingBlockViewModel { Heading = currentBlock.Heading }; if (currentBlock.ShowChildrenOfThisPage != null) { IEnumerable <PageData> allChildren = _loader.GetChildren <PageData>(currentBlock.ShowChildrenOfThisPage); IEnumerable <IContent> filteredChildren = FilterForVisitor.Filter(allChildren); viewModel.Pages = filteredChildren.Cast <PageData>() .Where(p => p.VisibleInMenu); } return(PartialView(viewModel)); }
//Describes a service that can be used to read content data objects from a repository! public override ActionResult Index(ListingBlock currentBlock) { var contentRepository = ServiceLocator.Current.GetInstance <IContentLoader>(); var viewModel = new ListingBlockViewModel { Heading = currentBlock.Heading }; if (currentBlock.ShowChildrenOfThisPage != null) { IEnumerable <PageData> children = contentRepository.GetChildren <PageData>(currentBlock.ShowChildrenOfThisPage); IEnumerable <IContent> filtered = FilterForVisitor.Filter(children); viewModel.Pages = filtered.Cast <PageData>().Where(x => x.VisibleInMenu); } return(PartialView(viewModel)); }
public override ActionResult Index(CustomerListingBlock currentBlock) { var viewmodel = new ListingBlockViewModel { Heading = currentBlock.Heading }; if (currentBlock.ChildrenOfThisPage != null) { IEnumerable <PageData> children = loader.GetChildren <PageData>( currentBlock.ChildrenOfThisPage); // Remove pages: // 1. that are not published // 2. that the visitor does not have Read access to // 3. that do not have a page template IEnumerable <IContent> filteredChildren = FilterForVisitor.Filter(children); // 4. that do not have "Display in navigation" selected viewmodel.Pages = filteredChildren.Cast <PageData>() .Where(page => page.VisibleInMenu); } return(PartialView(viewmodel)); }