public PartialViewResult SanPhamPartial(string maloai, int?page, string search) { var lsp = new List <SanPham>(); int pagenuber = page ?? 1; if (maloai == "") { lsp = db.LayDanhSachSanPham(); if (!string.IsNullOrEmpty(search)) { lsp = lsp.FindAll(n => n.TenSP.ToLower().Contains(search)); } } else { lsp = db.LaySanPhamTheoLoai(maloai); if (!string.IsNullOrEmpty(search)) { lsp = lsp.FindAll(n => n.MaSP.ToLower().Contains(search)); } } return(PartialView(lsp.ToPagedList(pagenuber, 10))); }