Lambda expression help needed

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 11 ans
Hopefully it's obvious what I'm trying to achieve just from the code

productVariants = productVariants.Where(pv => pv.AppliedDiscounts.Where(ad => ad.Id == discountId) as IList<ProductVariant>;


but here's some blurb anyway.

I'm trying to get the pv's from a list of pv's that have a certain discount code applied to them

Any help is appreciated.

Darren
Il y a 11 ans
Untested:

productVariants.Where(pv => pv.AppliedDiscounts.Where(ad => ad.Id == discountId).Count() > 0).ToList();
Il y a 11 ans
Still untested, but

Legend! Cheers Andy. Looks spot on to me
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.