Lambda expression help needed

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 лет назад
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
11 лет назад
Untested:

productVariants.Where(pv => pv.AppliedDiscounts.Where(ad => ad.Id == discountId).Count() > 0).ToList();
11 лет назад
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.