I am using ASP .Net MVC, and I would like to filter my DB result set, until now I've been using this method:
var auctions = from o in db.auctions select o;
And I'd check if user passed some pattern (searchName) from client form so result set would be filtered:
if (!String.IsNullOrEmpty(searchName))
{
auctions = auctions.Where(a => a.product_name.Contains(searchName));
}
That's fine if I want to check if product name contains single string variable, but I would need to check if product name contains ANY of array's strings passed as string from client's form and split with blank char something like this:
string[] words = searchName.Split(' ');
auctions = auctions.Where(a => a.product_name.Contains(anyStringInArrayWords));
How could I end up with this anyStringInArrayWords lambda impression sent to auctions.Where()?