I am attempting to write an expression for an advanced search. However, I need to check if each property is null
, otherwise an error will be thrown.
I have included the expression without the null checking below.
The result is output using jQuery dataTables.
filteredPeople = unitOfWork.PeopleRepository.Get().Where(c =>
IdSearchable && c.personID.ToString().Contains(param.sSearch.ToLower())
|| surnameSearchable && c.Surname.ToLower().Contains(param.sSearch.ToLower())
|| firstNameSearchable && c.FirstName.ToLower().Contains(param.sSearch.ToLower())
|| genderSearchable && c.Gender.ToLower().Contains(param.sSearch.ToLower())
));