I'm sorry if the way I asked the question is confusing. I have a .Net Core E-commerce project that sells music albums. I want to add a search bar so that the user can search for albums by title, artist or genre. Those are stored in a SQL db. I can't seem to find a way to compare the string that the user inputs to all three of those, only one. Here's what I have:
public ViewResult Search(string searchString)
{
string _searchString = searchString;
IEnumerable<Album> albums;
if (string.IsNullOrEmpty(_searchString))
{
albums = _albumRepository.Albums.OrderBy(p => p.AlbumId);
}
else
{
albums = _albumRepository.Albums.Where(p => p.Name.ToLower().Contains(_searchString.ToLower()));
}
return View("~/Views/Album/List.cshtml", new AlbumListViewModel { Albums = albums});
}