public ActionResult LoaiSP(int typeId, int page) { Session[CommonConstants.CURRENT_ROUTE] = (int)CommonConstants.Shop_Route.Types; Session[CommonConstants.CURRENT_ROUTE_ID] = typeId; // count number of product var temp_Model = new LayoutModel(); var count_product_type = temp_Model.Get_Count_Product_Type(typeId); string action = "type"; ViewBag.Type = typeId; ShopModel models = new ShopModel(action, typeId, page); if (models.ListProduct.Count() != 0) { ViewBag.PageTitle = models.get_Type(typeId); } ViewBag.Page = page; ViewBag.Count = count_product_type; ViewBag.Type = typeId; // 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)); }