private Expression <Func <Transaction, bool> > GetPredicate(TransactionsSearchCriteria searchCriteria) { if (searchCriteria.IsFraud.HasValue && !string.IsNullOrEmpty(searchCriteria.SearchNameDest)) { return((t) => t.IsFraud == searchCriteria.IsFraud && t.NameDest == searchCriteria.SearchNameDest); } if (searchCriteria.IsFraud.HasValue && string.IsNullOrEmpty(searchCriteria.SearchNameDest)) { return((t) => t.IsFraud == searchCriteria.IsFraud); } else { return((t) => t.NameDest == searchCriteria.SearchNameDest); } }
public async Task <IPagedList <Transaction> > Find(TransactionsSearchCriteria searchCriteria, int pageNumber, int pageSize) { return(await _repository.Find(GetPredicate(searchCriteria), pageNumber, pageSize)); }