Reputation: 219
I have all selected Product.Id
(guids) inside a List<Guid> cartList
. I'm trying to get all matched products with a lambda expression through Entity Framework.
List<Product> getProducts = db.Products.Where(x=> x.Id == /*that contains any ids in cartList*/)
Any idea how to make this work?
Upvotes: 1
Views: 781
Reputation: 5719
Try this:
List<Product> getProducts = db.Products.Where(x=> cartList.Contains(x.Id)).ToList()
Upvotes: 3