Example #1
0
        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));
        }
Example #2
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));
        }