I'm aiming to do a lamba expression with this query, and I'm stuck. I had to do some easy lambdas before and now I need to do a multiple condition mixing or and ands in this one and I'm new with this.
So let me explain a bit of a this structure and you will see why is tricky (at least for a newbie at lambda). I have Requests, where request have many attributes, attributes have name and value, because according to request State they have different attributes in this case RequestState.APPROVAL_PENDING is a constant that will bring the right state and attribute name have being also compared with constants with the attribute names I need and the value need find is wwid in the attribute value.
Then I will make a query.tolist(); and get all the requests, but I need to find out how to lambda this.
var query = from request in DBContext.REQUESTs
join attr in DBContext.REQUEST_ATTRIBUTES on request.REQUEST_ID equals attr.REQUEST_ID
where (attr.ATTRIBUTE_VALUE == wwid &&
(attr.ATTRIBUTE_NAME == RequestAttributes.APPROVER_2_WWID || attr.ATTRIBUTE_NAME == RequestAttributes.APPROVER_WWID))
&& request.STATE_ID == RequestState.APPROVAL_PENDING
select request;