I am trying this but it doesn't work how can i correct this.
Actually i faced two conditions in both the case first i need to check if record exist, in first case if it exist i want assign some value not from edmx, in second case if record exist i want to assign value from the edmx file.
IsPriceApplied = cn.OrderDressings.Any(x => x.OrderID == OrderID && x.OrderItemID == ProductID) ?(from yy in cn.OrderDressings where yy.OrderID==OrderID && yy.OrderItemID==ProductID select yy.IsPriceApplied):Do Nothing
As you can see i am using any to check the record first.
_allAppliedItemList.AddRange((from xx in DressingItems
where xx.DressingInfo.CatID == item.CategoryID
select new btnObject()
{
CustomizationType = CategoryType.Dressing,
BtnName = xx.DressingInfo.Description,
Price = (double)xx.DressingInfo.MainPrice,
IsSelected = xx.IsDefault,
MaxLimit = item.DefaultFreeCount,
CategoryID = xx.DressingInfo.CatID,
IsDefaultLimit = item.IsDefaultLimit,
ID = xx.DressingInfo.DressingID,
ButtonColor = cn.OrderDressings.Any(x => x.OrderID == OrderID && x.OrderItemID == ProductID)
? ButtonColor.Green
: ButtonColor.Red,
catName = item.CatName,
IsPriceApplied = cn.OrderDressings.Any(x => x.OrderID == OrderID && x.OrderItemID == ProductID)
? (from yy in cn.OrderDressings where yy.OrderID==OrderID && yy.OrderItemID==ProductID select yy.IsPriceApplied)
: noting
}
).ToList());