I have a List<string> of ProductTypes
such as Vegetables, Dairy, Meat
which I receive from a query string in Asp.Net Core.
In the database, there is a Product table which contains a ProductType column that has each product's type in a text field)
I want to select from the Product database table all the Products that are in the ProductTypes list as received. I did this:
var Result = (from p in _context.Product
join t in ProductTypes on p.ProductType equals t select p).ToList();
My effort above has an (incorrect) empty result except if only one ProductType is passed, in which case it works correctly.
How can I accomplish a correct Result set if multiple ProductTypes are passed?