public ActionResult Search(string term) { List <Book> list = new List <Book>(); if (!string.IsNullOrEmpty(term)) { list = bookRepository.Search(a => a.Title.ToLower().Contains(term.ToLower()) || a.Description.ToLower().Contains(term.ToLower()) || a.Author.FullName.ToLower().Contains(term.ToLower())).ToList(); } else { list = bookRepository.List().ToList(); } return(View("Index", list)); }
public ActionResult Search(string term) { var result = bookRepository.Search(term); return(View("Index", result)); }