Exemple #1
0
        // GET: ShoppingCart
        public ActionResult Index(string searchString, int?page)
        {
            if (Session[CommonConstants.ShoppingCartSession] == null)
            {
                Session[CommonConstants.ShoppingCartSession] = new List <ShoppingCartViewModel>();
            }
            var cart             = new ShoppingCartViewModel();
            int defaultPageSize  = int.Parse(ConfigHelper.GetByKey("pageSizeAjax"));
            var common           = new CommonController(_productService);
            int currentPageIndex = page ?? 1;

            cart.ListProducts = common.ProductListAjax(page, searchString).ToPagedList(currentPageIndex, defaultPageSize);
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_AjaxProductList", cart.ListProducts));
            }
            return(View(cart));
        }