Пример #1
0
        public ActionResult Trang(int page)
        {
            Session[CommonConstants.CURRENT_ROUTE] = (int)CommonConstants.Shop_Route.Pages;

            //string action = "page";
            var temp_Model        = new LayoutModel();
            var count_product_all = temp_Model.Get_Count_Product_All();


            ShopModel models = new ShopModel(page);

            ViewBag.PageTitle = "Trang " + page;
            ViewBag.Page      = page;
            ViewBag.Count     = count_product_all;

            var list_sort_type = new List <Sort_Type>()
            {
                new Sort_Type {
                    Sort_Name = "Mới nhất", Value = (int)CommonConstants.Sort_Type.ID_DESC
                },
                new Sort_Type {
                    Sort_Name = "Cũ nhất", Value = (int)CommonConstants.Sort_Type.ID_ASC
                },
                new Sort_Type {
                    Sort_Name = "Giá tăng dần", Value = (int)CommonConstants.Sort_Type.Price_ASC
                },
                new Sort_Type {
                    Sort_Name = "Giá giảm dần", Value = (int)CommonConstants.Sort_Type.Price_DESC
                }
            };
            int current_sort = 2; // 2: ID_DESC = mới nhất

            if (Session[CommonConstants.SORT_SESSION] != null)
            {
                current_sort = (int)Session[CommonConstants.SORT_SESSION];
            }

            ViewBag.sort_Type = new SelectList(list_sort_type, "Value", "Sort_Name", current_sort);

            return(View(models));
        }