I want to write code like the following -
public IQueryable<Invoice> InvoiceFilterForMonthAndYear(DateTime? monthAndYear = null)
{
var invoices = _invoices.Where(MonthAndYearPredicate(monthAndYear);
return invoices;
}
private bool MonthAndYearPredicate(Invoice invoice, DateTime? monthAndYear)
{
//code to check if the invoice start or end dates is from the falls in the month I am checking for
}
But I can't use a predicate like that because the predicate expects just one parameter.
I know I could write a Where clause in InvoiceFilterForMonthAndYear
to do the work, but
I want to put the logic for the comparison into its own method.