public IActionResult ExperienceList(int[] filterCategoryIds, string searchKeyWord, string countryCode, int page = 1) { const int pageSize = 6; Console.WriteLine(countryCode); var experiencesToDisplay = _ExperienceService.ExperienceListByFilters(filterCategoryIds, searchKeyWord, countryCode, page, pageSize); var totalNumberOfItemsToDisplay = _ExperienceService.GetFilteredExperienceCount(filterCategoryIds, searchKeyWord, countryCode); var experienceListModel = new ExperienceListModel() { Experiences = experiencesToDisplay, AllCategories = _CategoryService.GetAll(), FilterCategoryIds = filterCategoryIds, ChosenCountryCode = countryCode, PageInfo = new PageInfo() { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = totalNumberOfItemsToDisplay, filterCategoryIds = filterCategoryIds } }; return(View(experienceListModel)); }
public IActionResult ExperienceList(int[] filterCategoryIds, int page = 1) { const int pageSize = 6; var experiencesToDisplay = _ExperienceService.ExperienceListByFilters(filterCategoryIds, "", "", page, pageSize); var totalNumberOfItemsToDisplay = _ExperienceService.GetFilteredExperienceCount(filterCategoryIds, "", ""); var experienceListModel = new ExperienceListModel() { Experiences = experiencesToDisplay, AllCategories = _CategoryService.GetAll(), FilterCategoryIds = filterCategoryIds, PageInfo = new PageInfo() { CurrentPage = page, ItemsPerPage = pageSize, TotalItems = totalNumberOfItemsToDisplay, filterCategoryIds = filterCategoryIds } }; return(View(experienceListModel)); }
public IActionResult Index(int id) { Location location = db.Locations.FirstOrDefault(l => l.Id == id); ICollection <Experience> experiences = db.Experiences.Where(e => e.LocationId == id).ToList(); ExperienceListModel model = new ExperienceListModel(location, experiences); return(View(model)); }