Exemple #1
0
        public async Task CreatePaymentsUpToRecur()
        {
            var recurringPayments = await recurringPaymentDbAccess.GetRecurringPayments()
            ;

            var recPaymentsToCreate = recurringPayments
                                      .Where(x => x.RelatedPayments.Any())
                                      .Where(x => RecurringPaymentHelper
                                             .CheckIfRepeatable(x.RelatedPayments
                                                                .OrderByDescending(d => d.Date)
                                                                .First()))
                                      .Select(x => new Payment(
                                                  RecurringPaymentHelper.GetPaymentDateFromRecurring(x),
                                                  x.Amount,
                                                  x.Type,
                                                  x.ChargedAccount,
                                                  x.TargetAccount,
                                                  x.Category,
                                                  x.Note,
                                                  x))
                                      .ToList();

            await recurringPaymentDbAccess.SaveNewPayments(recPaymentsToCreate)
            ;
        }
Exemple #2
0
        public async Task CreatePaymentsUpToRecur()
        {
            var recurringPayments = await recurringPaymentDbAccess.GetRecurringPayments()
                                                                  .ConfigureAwait(false);

            await recurringPaymentDbAccess.SaveNewPayments(recurringPayments.Where(x => RecurringPaymentHelper
                    .CheckIfRepeatable(x.RelatedPayments
                        .OrderByDescending(d => d.Date)
                        .First()))
                .Select(x => new Payment(
                    DateTime.Now,
                    x.Amount,
                    x.Type,
                    x.ChargedAccount,
                    x.TargetAccount,
                    x.Category,
                    x.Note))
                .ToList())
                .ConfigureAwait(false);
        }