0

I currently have two checkboxes, one is called Payment and the other is called Reversal. If Payment or Reversals are ticked, the Payment or Reversal transactions should be queried, otherwise not. I wrote a predicate builder but it only works for One ticked at a time. I'm trying to display both but it's not working, it displays nothing.

var predicate = PredicateBuilder.True<TransactionDTO>();

if (parameters.Reversal)
{
     predicate = predicate.And(x => x.Description.Contains("Reversal"));
}

if (parameters.Payment)
{
    predicate = predicate.And(x => x.Description.Contains("Payment"));
}

transactionDTOCollection = new BindableCollection<TransactionDTO>(transactionDTOCollection.Where(predicate.Compile()).AsParallel());

I think it has to do with how the predicate is written. It starts with an And + And but it should be And(or + or).

Master
  • 2,038
  • 2
  • 27
  • 77

0 Answers0