Ejemplo n.º 1
0
        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));
        }