public ActionResult SearchByPriceAndBrand(string brands, string prices) { int brandInt = 13;// load tat ca cac thuong hieu int priceInt = 8;// load tat ca cac loai gia LoadDropDownList(); if (!String.IsNullOrEmpty(brands)) { brandInt = Int32.Parse(brands); } if (!String.IsNullOrEmpty(prices)) { priceInt = Int32.Parse(prices); } if (String.IsNullOrEmpty(prices) && String.IsNullOrEmpty(brands)) { brandInt = 13; priceInt = 8; } var listOFProducts = new List<Product>(); var brandLaptop = db.Brands.FirstOrDefault(x => x.ID == brandInt); var manager = new DataManager(); int BlockSize = 8; if (brandLaptop != null) { listOFProducts = manager.GetProductsByPrice(1, BlockSize, brandInt, priceInt); } TempData["brandInt"] = brands; TempData["priceInt"] = prices; return View(listOFProducts); }
public ActionResult InfinateScrollSearchByPrice(int BlockNumber, int brandID, int priceID) { //////////////// THis line of code only for demo. Needs to be removed //// System.Threading.Thread.Sleep(800); ////////////////////////////////////////////////////////////////////////// int BlockSize = 8; var manager = new DataManager(); var products = manager.GetProductsByPrice(BlockNumber, BlockSize, brandID, priceID); var jsonModel = new DataManager.JsonModel { NoMoreData = products.Count < BlockSize, HTMLString = RenderPartialViewToString("ProductList", products) }; return Json(jsonModel); }