public ActionResult Index(string searchTerm) { List <Project> emptyList = new List <Project>(); if (string.IsNullOrEmpty(searchTerm)) { //When search is empty returns all projects emptyList = pdb.getOtherData().ToList(); } else { //When search returns only the specified project emptyList = pdb.searchProjectData(searchTerm).ToList(); } return(View(emptyList)); }