At the moment I am retrieving my results as follows :
public List<claim> GetClaims()
{
return _db.claims.OrderBy(cl => cl.claimId).ToList();
}
But now I am trying to add up to 8 conditional where clauses based on filters above my listview.
So I turned into:
public List<claim> GetFilteredClaims(string submissionId, string claimId,
string organization, string status,
string filterFromDate, string filterToDate,
string region, string approver)
{
return _db.claims.Where(cl => cl.submissionId == 5).ToList();
}
How can I do a check for each filter to add a where clause only if they contain a value?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…