Possible Duplicate:
Linq If Statement
I am trying to run a query using Linq, but before the where clause I wanted to specify the If condition but I am not getting proper syntax(may be) or is it not possible?
I have searched a lot but they use if and else before query, but I want If within query.
Is it possible like:
var q = (from mortgageapplication in context.MortgageApplications
if(mortgageapplication.purpose of loan==7)
{
where mortgageapplication.MortgageActive == true && mortgageapplication.MortgageCoordinator==ID
}
I am just trying but let me know if we can place if before where?
This query would be logically equivalent:
The logic goes as follows, you only want to check if it is active and by the given coordinator. Otherwise get any application.