Пример #1
0
        public ActionResult List(PetsListViewModel model)
        {
            this.ViewBag.SelectedSpecies = model.SelectedSpecies;

            model.Pets = this.pets.GetAllFilteredAndPaged(
                model.CurrentPage,
                model.PageSize,
                model.OrderBy,
                model.OrderType,
                model.SearchText,
                model.SelectedBreeds,
                model.SelectedSpecies)
                .To<ListedPetViewModel>().ToList();

            var totalNumberOfPets =
                this.pets.GetFilteredTotalCount(
                  model.OrderBy,
                    model.OrderType,
                    model.SearchText,
                    model.SelectedBreeds,
                    model.SelectedSpecies);

            model.TotalPages = (int)Math.Ceiling(totalNumberOfPets / (decimal)model.PageSize);

            return this.PartialView("_SearchPetPartial", model);
        }
Пример #2
0
        public ActionResult List()
        {
            var model = new PetsListViewModel
            {
                SelectedSpecies = 0,
                SelectedBreeds = 0,
                CurrentPage = 1,
                OrderBy = "date",
                OrderType = "desc",
                PageSize = 10,
            };

            this.ViewBag.SelectedSpecies = model.SelectedSpecies;

            model.Pets = this.pets.GetAllFilteredAndPaged(
                model.CurrentPage,
                model.PageSize,
                model.OrderBy,
                model.OrderType,
                model.SearchText,
                model.SelectedBreeds,
                model.SelectedSpecies)
                .To<ListedPetViewModel>().ToList();

            var totalNumberOfPets =
                this.pets.GetFilteredTotalCount(
                  model.OrderBy,
                    model.OrderType,
                    model.SearchText,
                    model.SelectedBreeds,
                    model.SelectedSpecies);

            model.TotalPages = (int)Math.Ceiling(totalNumberOfPets / (decimal)model.PageSize);

            return this.View(model);
        }