I have a large query from which I'm trying to get data using the Where
condition with the parameters StudentName
and StudentSurname
, which is set by the user through a search form.
If StudentName
and StudentSurname
has values, everything is fine, but if one of them does not have a value, then I receive nothing.
Problem is that in such case I want this foreach loop to get data anyway without the parameters that are null.
foreach (var item in innerJoinQuery.Where(item => item.StudentName == StudentName
&& item.StudentSurname == StudentSurname)