Tuesday, September 17, 2013

How to make a linq statement if a record exist

How to make a linq statement if a record exist

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

No comments:

Post a Comment