BudgetAnalyser.Engine.Statement.StatementModel.BaseFilterQuery C# (CSharp) Method

BaseFilterQuery() private method

private BaseFilterQuery ( GlobalFilterCriteria criteria ) : IEnumerable
criteria GlobalFilterCriteria
return IEnumerable
        private IEnumerable<Transaction> BaseFilterQuery(GlobalFilterCriteria criteria)
        {
            if (criteria.Cleared)
            {
                return AllTransactions.ToList();
            }

            IEnumerable<Transaction> query = AllTransactions;
            if (criteria.BeginDate != null)
            {
                query = AllTransactions.Where(t => t.Date >= criteria.BeginDate.Value);
            }

            if (criteria.EndDate != null)
            {
                query = query.Where(t => t.Date <= criteria.EndDate.Value);
            }

            return query;
        }