public IActionResult All(int page = DefaultPageNumber) { var ads = new AllAdvertisementsViewModel { Advertisements = this.adsService.GetAll <AdvertisementViewModel>(page, AdsCount), AdvertisementsCount = this.adsService.AdsCount(), Page = page, }; return(this.View(ads)); }
public IActionResult Search(string keyWords, int page = DefaultPageNumber) { if (string.IsNullOrWhiteSpace(keyWords)) { return(this.RedirectToAction(nameof(this.All))); } this.TempData["KeyWords"] = keyWords; var ads = new AllAdvertisementsViewModel { Advertisements = this.adsService.SearchResult <AdvertisementViewModel>(page, AdsCount, this.TempData["KeyWords"].ToString()), AdvertisementsCount = this.adsService.SearchCount(), Page = page, }; return(this.View(ads)); }