I have a scenario where I am using lambda expression to filter data by name, address and phone number. But when one property has no value then my filter considers where property is null and it give wrong results. Is there any option to remove a where condition out of three cases with a if condition if property is null. I mean is there any case to add where/check only for object where properties having values?
var filterCriteria ={
name: "abc",
address:"",
phone:""
}
var Details = _context.LogEntities
.Where(p => p.name == (filterCriteria.name))
.Where(p => p.address== (filterCriteria.address))
.Where(p => p.phone== (filterCriteria.phone))
return Json(Details);