I am trying to get the result based upon the values of variables temp_DestinationGroupName, temp_CountryName and temp_RateTypeId.
If any of these variables are null or 0, it should not be included in where clause and rest statements should work and bring the result. I am getting zero rows using this query. Kindly suggest me something with these conditions in where clause. i tried following solutions on stackoverflow but still not getting the desired result.
var Rows = _CustomerRatesList.Where(w => (w.Id != rates.Id)
&& (w.DestinationGroupName == temp_DestinationGroupName || temp_DestinationGroupName!= null)
&& (w.CountryName == temp_CountryName || temp_CountryName!=null)
&& (w.RateTypeId == temp_RateTypeId || temp_RateTypeId !=0));
var Rows = _CustomerRatesList.Except(w => (w.DestinationGroupName == temp_DestinationGroupName || temp_DestinationGroupName!= null) && (w.CountryName == temp_CountryName || temp_CountryName!=null) && (w.RateTypeId == temp_RateTypeId || temp_RateTypeId !=0)).Where(w => w.Id != rates.Id);