public ActionResult Index(int?number = null) { var settings = _services.WorkContext.CurrentSite.As <SeoSitemapSettingsPart>(); var index = number != null ? number - 1 : default(int?); return(new SitemapResult(this, settings, _sitemapService.GetEntries(), index)); }
public ActionResult Index(PagerParameters pagerParameters, string provider = null, SitemapEntryOrderBy orderBy = SitemapEntryOrderBy.Provider) { var pager = new Pager(_orchardServices.WorkContext.CurrentSite, pagerParameters); var query = _sitemapService.GetEntries(); if (!String.IsNullOrWhiteSpace(provider)) { query = query.Where(x => x.ProviderName == provider); } switch (orderBy) { case SitemapEntryOrderBy.Priority: query = query.OrderByDescending(x => x.Priority); break; case SitemapEntryOrderBy.ChangeFrequency: query = query.OrderBy(x => x.ChangeFrequency); break; case SitemapEntryOrderBy.LastModified: query = query.OrderByDescending(x => x.LastModifiedUtc); break; case SitemapEntryOrderBy.Url: query = query.OrderBy(x => x.Url); break; case SitemapEntryOrderBy.Provider: default: query = query.OrderBy(x => x.ProviderDisplayName); break; } var totalCount = query.Count(); var pageOfEntries = query.Skip(pager.GetStartIndex()).Take(pager.Page * pager.PageSize); var viewModel = new SitemapIndexViewModel { Handlers = _sitemapService.GetHandlers().ToArray(), Entries = pageOfEntries, SelectedProvider = provider, OrderBy = orderBy, Pager = _orchardServices.New.Pager(pager).TotalItemCount(totalCount) }; return(View(viewModel)); }
public ActionResult Html() { var entries = _sitemapService.GetEntries(); return(new ShapeResult(this, Shape.Sitemap(Entries: entries))); }