我有一个报价,可以是任意数量的类别。但是,我不希望该提议出现两次或更多。
我想知道是否有可能有一个 where 子句来确定该提议是否已经存在于该 select 语句中,如果是这样显然可以忽略它。
这是 linq 查询:
Offers = from o in offerCategories
orderby o.RewardCategory.Ordering, o.Order
where o.RewardOffer.IsDeleted == false
select new OfferOverviewViewModel
{
Partner = o.RewardOffer.Partner,
Description = String.Format("{0} {1}", o.RewardOffer.MainTitle, o.RewardOffer.SecondaryTitle),
OfferId = o.OfferId,
FeaturedOffer = o.RewardOffer.FeaturedOfferOrder.HasValue,
Categories = from c in offerCategories.Where(oc => oc.OfferId == o.OfferId)
orderby c.RewardCategory.Ordering
select new CategoryDetailViewModel
{
Description = c.RewardCategory.DisplayName
}
},