예제 #1
0
        public async Task <IActionResult> GetPaymentTransactionsByAdmin(PaymentTransactionsByAdminVM paymentTransactionsByAdmin)
        {
            if (paymentTransactionsByAdmin.Password != _adminPassword)
            {
                paymentTransactionsByAdmin.PaymentTransactions = new List <PaymentTransactionVM>();
                paymentTransactionsByAdmin.Error       = string.IsNullOrEmpty(paymentTransactionsByAdmin.Password) ? "" : "Enter valid admin password";
                paymentTransactionsByAdmin.HasPassword = false;
                return(View(paymentTransactionsByAdmin));
            }
            IEnumerable <PaymentTransactionDTO> paymentTransactionDTOs = await _paymentTransactionService
                                                                         .GetAllPaymentTransactions(paymentTransactionsByAdmin.From, paymentTransactionsByAdmin.To);

            IEnumerable <PaymentTransactionVM> paymentTransactionVMs = paymentTransactionDTOs.ToPaymentTransactionVMs();

            paymentTransactionsByAdmin.PaymentTransactions = paymentTransactionVMs;
            paymentTransactionsByAdmin.HasPassword         = true;
            return(View(paymentTransactionsByAdmin));
        }
예제 #2
0
        public async Task <IActionResult> GetPaymentTransactionsByAdmin(string password,
                                                                        DateTime?from,
                                                                        DateTime?to)
        {
            PaymentTransactionsByAdminVM paymentTransactionsByAdmin;

            if (password != _adminPassword)
            {
                paymentTransactionsByAdmin = new PaymentTransactionsByAdminVM(password, "Enter valid admin password", false, new List <PaymentTransactionVM>(), from, to);
                return(View(paymentTransactionsByAdmin));
            }

            IEnumerable <PaymentTransactionDTO> paymentTransactionDTOs = await _paymentTransactionService
                                                                         .GetAllPaymentTransactions(from, to);

            IEnumerable <PaymentTransactionVM> paymentTransactionVMs = paymentTransactionDTOs.ToPaymentTransactionVMs();

            paymentTransactionsByAdmin = new PaymentTransactionsByAdminVM(password, "", true, paymentTransactionVMs, from, to);
            return(View(paymentTransactionsByAdmin));
        }