I have 3 search textbox values. i need to check string.isnullorEmpty for each variable and have to compare with the linq query.
My Text Values:
Manufacturer
Project Code
PartNo
Conditions:
if i search any one of the above i should get the result
If i enter 3 box values i should get the result
If i enter any 2 then i should get result.
My code as follows
if (!string.IsNullOrEmpty(manufacturer)) { var filteredResult = _entity.MaterialMasters.Where(x => x.Manufacturer == manufacturer); } if (!string.IsNullOrEmpty(projectcode)) { var filteredResult = _entity.MaterialMasters.Where(x => x.ProjectCode== projectcode); } if (!string.IsNullOrEmpty(part)) { var filteredResult = _entity.MaterialMasters.Where(x => x.Part== part); } To avoid multiple conditions how to make dynamic where clause for this? Please find out the solution for this..
public static IEnumerable<T> WhereTest<T>(this IEnumerable<T> , Func...)