// // GET: /Home/ public ActionResult Index() { ShopManager manager = new ShopManager(null); int total = 0; int pageSize = 30; int pageIndex = 1; List<Product> pdts = manager.SearchProducts("", pageIndex, pageSize, out total); ViewBag.total = total; ViewBag.pageSize = pageSize; ViewBag.page = pageIndex; return View(pdts); }
// // GET: /Product/ public ActionResult Search() { string keyWord = Request["searchKey"]; ViewData["searchKey"] = keyWord; int pageIndex = 1; int pageSize = 15; if (!string.IsNullOrEmpty(Request["p"])) { int.TryParse(Request["p"], out pageIndex); } ShopManager manager=new ShopManager(null); int total = 0; List<Product> pdts = manager.SearchProducts(keyWord, pageIndex, pageSize, out total); ViewBag.total = total; ViewBag.pageSize = pageSize; ViewBag.page = pageIndex; return View("Search", pdts); }