public ViewViewComponentResult Invoke(int petTypeId, int categoryId) { var model = new PetBreedListViewModel { Categories = _categoryService.GetByCategory(categoryId), PetBreeds = _petBreedService.GetByCategory(petTypeId), petTypes = _petTypeService.GetByCategory(petTypeId) }; return(View(model)); }
public IActionResult Ilanlar(int category, int petBreed, int petTypes, int page = 1) { int pageSize = 10; var adsByCategory = _adsService.İlanlarinKategorisiVePetTipi(category, petBreed, petTypes); AdsListViewModel model = new AdsListViewModel { PetTypes = _petTypeService.GetByCategory(petTypes), IlanlarKategorilerVePetTipleri = adsByCategory.Skip((page - 1) * pageSize).Take(pageSize).ToList(), PageCount = (int)Math.Ceiling(adsByCategory.Count / (double)pageSize), PageSize = pageSize, CurrentCategory = category, CurrentPage = page }; return(View(model)); }