public async Task <IActionResult> Vacancies(int page = 1) { ViewData["Title"] = $"{Core.Pages.Vacancies}"; var pagedResult = await _vacancyManager.GetVacancies(page); var model = new StaticPagedList <VacancyViewModel>(pagedResult.Select(o => new VacancyViewModel(o, Settings.Current.WebSiteUrl)), pagedResult); return(View("~/Views/Home/Vacancies.cshtml", model)); }
public async Task <IActionResult> GetSitemap() { var page = 1; var key = "sitemap"; var xml = _cache.Get(key)?.ToString(); if (string.IsNullOrEmpty(xml)) { IPagedList <Publication> publications; IPagedList <Vacancy> vacancies; var sitemap = new Sitemap(); sitemap.Add(CreateUrl(Settings.Current.WebSiteUrl)); sitemap.Add(CreateUrl(Settings.Current.WebSiteUrl + "partners/")); page = 1; do { publications = await _publicationManager.GetPublications(null, page); page++; foreach (var p in publications) { var publication = new PublicationViewModel(p, Settings.Current.WebSiteUrl); sitemap.Add(CreateUrl(publication.ShareUrl)); } }while (publications.HasNextPage); page = 1; do { vacancies = await _vacancyManager.GetVacancies(page); page++; foreach (var v in vacancies) { var vacancy = new VacancyViewModel(v, Settings.Current.WebSiteUrl); sitemap.Add(CreateUrl(vacancy.ShareUrl)); } }while (vacancies.HasNextPage); xml = sitemap.ToXml(); _cache.Set(key, xml, TimeSpan.FromMinutes(10)); } return(Content(xml, Sitemap.MimeType)); }