Ejemplo n.º 1
0
        private AllPagedProductsViewModel GetModel(int page,
                                                   int producerId,
                                                   string searchString,
                                                   string value)
        {
            var allProducts = this.products
                              .All(page, producerId, searchString, value)
                              .To <AllProductsViewModel>()
                              .ToList();

            var productModel = new AllPagedProductsViewModel
            {
                Products   = allProducts,
                Pagination = new PaginationViewModel
                {
                    CurrentPage  = page,
                    ItemsPerPage = GlobalConstants.DefaultPageSize,
                    TotalItems   = producerId == 0 ?
                                   this.products.CountProducts(searchString) : this.products.CountProductsByProducer(producerId, searchString)
                },
                ProducerId   = producerId,
                Value        = value,
                OrderByPrice = OrderByPrice(),
                Producers    = GetAllProducers(),
                SearchString = searchString
            };

            return(productModel);
        }
Ejemplo n.º 2
0
 public ActionResult All(AllPagedProductsViewModel productModel)
 {
     int producerId = productModel.ProducerId;
     return View(GetModel(GlobalConstants.DefaultPage,
         producerId,
         productModel.SearchString,
         productModel.Value));
 }
Ejemplo n.º 3
0
        public ActionResult All(AllPagedProductsViewModel productModel)
        {
            int producerId = productModel.ProducerId;

            return(View(GetModel(GlobalConstants.DefaultPage,
                                 producerId,
                                 productModel.SearchString,
                                 productModel.Value)));
        }
Ejemplo n.º 4
0
        private AllPagedProductsViewModel GetModel(int page,
                                                   int producerId,
                                                   string searchString,
                                                   string value)
        {
            var allProducts = this.products
               .All(page, producerId, searchString, value)
               .To<AllProductsViewModel>()
               .ToList();

            var productModel = new AllPagedProductsViewModel
            {
                Products = allProducts,
                Pagination = new PaginationViewModel
                {
                    CurrentPage = page,
                    ItemsPerPage = GlobalConstants.DefaultPageSize,
                    TotalItems = producerId == 0 ?
                        this.products.CountProducts(searchString) : this.products.CountProductsByProducer(producerId, searchString)

                },
                ProducerId = producerId,
                Value = value,
                OrderByPrice = OrderByPrice(),
                Producers = GetAllProducers(),
                SearchString = searchString
            };

            return productModel;
        }