예제 #1
0
        public ActionResult Hang(int brandId, int page)
        {
            Session[CommonConstants.CURRENT_ROUTE]    = (int)CommonConstants.Shop_Route.Brands;
            Session[CommonConstants.CURRENT_ROUTE_ID] = brandId;

            // count number of product
            var temp_Model          = new LayoutModel();
            var count_product_brand = temp_Model.Get_Count_Product_Brand(brandId);

            string action = "brand";

            ViewBag.Brand = brandId;
            ShopModel models = new ShopModel(action, brandId, page);

            if (models.ListProduct.Count() != 0)
            {
                ViewBag.PageTitle = models.ListProduct[0].BrandName;
            }

            ViewBag.Page  = page;
            ViewBag.Count = count_product_brand;
            ViewBag.Brand = brandId;

            // sort part
            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));
        }