示例#1
0
        /// <inheritdoc />
        public async Task <OperationResult> DeletePayment(PaymentViewModel paymentViewModel)
        {
            if (!await dialogService.ShowConfirmMessage(Strings.DeleteTitle, Strings.DeletePaymentConfirmationMessage)
                .ConfigureAwait(true))
            {
                return(OperationResult.Succeeded());
            }

            if (paymentViewModel.IsRecurring &&
                await dialogService
                .ShowConfirmMessage(Strings.DeleteRecurringPaymentTitle, Strings.DeleteRecurringPaymentMessage)
                .ConfigureAwait(true))
            {
                await modifyPaymentAction.DeleteRecurringPayment(paymentViewModel.RecurringPayment.Id)
                .ConfigureAwait(true);
            }

            var result = await modifyPaymentAction.DeletePayment(paymentViewModel.Id)
                         .ConfigureAwait(true);

            await context.SaveChangesAsync()
            .ConfigureAwait(true);

            return(!result.Success
                ? OperationResult.Failed(result.Message)
                : OperationResult.Succeeded());
        }
示例#2
0
        /// <inheritdoc />
        public async Task DeletePayment(PaymentViewModel paymentViewModel)
        {
            if (!await dialogService.ShowConfirmMessage(Strings.DeleteTitle, Strings.DeletePaymentConfirmationMessage))
            {
                return;
            }

            if (paymentViewModel.IsRecurring &&
                await dialogService.ShowConfirmMessage(Strings.DeleteRecurringPaymentTitle, Strings.DeleteRecurringPaymentMessage))
            {
                await modifyPaymentAction.DeleteRecurringPayment(paymentViewModel.RecurringPayment.Id);
            }

            await modifyPaymentAction.DeletePayment(paymentViewModel.Id);

            await context.SaveChangesAsync();
        }