// GET: Doctors public ActionResult Index(string searchString = "") { IBL bl = new BLImplement(); List <DoctorViewModel> lst = new List <DoctorViewModel>(); foreach (var item in bl.getAllDoctors()) { lst.Add(new DoctorViewModel(item)); } if (!String.IsNullOrEmpty(searchString)) { lst = lst.Where(s => s.Name.ToLower().Contains(searchString.ToLower()) || s.SpecialName.ToLower().Contains(searchString.ToLower())).ToList(); } return(View(lst)); }