public ViewResult Index(int?soCho, int?maHangXe, string currentFilter, string searchString, int?page) { CarShowroomDbContext context = new CarShowroomDbContext(); if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; var xe = from s in context.Xe select s; if (!String.IsNullOrEmpty(searchString)) { xe = xe.Where(s => s.TenXe.Contains(searchString)); } if (maHangXe.HasValue) { xe = xe.Where(s => s.MaHangXe == maHangXe); } if (soCho.HasValue) { xe = xe.Where(s => s.SoCho == soCho); } int pageSize = 6; int pageNumber = (page ?? 1); // return(View(xe.OrderBy(x => x.MaXe).ToPagedList(pageNumber, pageSize))); }