I'm still trying to get my head wrapped around LINQ and its functions.
I am trying to build a search. For example, I want to return results that match the search string (which we call search terms). In the database, for example, we have results such as:
ID ItemNum CategoryType
1 2737 Full Length Dresses
2 5353 Full Length Dresses
If a person searches "Full Dresses", I want to be able to return the two results above. However, using Contains
does not work. Searching "Full Length Dresses" does work. I'm guessing I need to somehow split the search string into an array and then search using each item in the array, but I'm not sure how to go about doing this.
var results = db.Products.Where(p => p.CategoryType.Contains(searchString)).Select(p => p).Distinct();
Thanks.