public ActionResult Index(string currentFilter, string searchString, int?page) { var authId = User.Identity.GetUserId(); doctor dataDoctor = db.doctors.FirstOrDefault(e => e.userId == authId); ViewBag.Doctor = doctorService.DoctorAuth(authId); /*call all data from service*/ var data = doctorService.TodaySchedule(dataDoctor.userId); /*search data from name patient*/ if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; int pageNumber = (page ?? 1); int pageSize = 10; return(View(data.ToPagedList(pageNumber, pageSize))); }