Exemplo n.º 1
0
        public async Task <IActionResult> OverdraftPayment()
        {
            OverdraftPaymentVM opVM = new OverdraftPaymentVM {
                Accounts         = await _AcctRepo.Get(userManager.GetUserId(User)),
                OverdraftBalance = _UserRepo.Get(userManager.GetUserId(User)).Overdraft,
            };

            return(View(opVM));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OverdraftPayment([Bind("PaymentFromAccount, Amount, AccountID")] OverdraftPaymentVM model)
        {
            model.AccountBalance = (await _AcctRepo.Get(model.AccountID)).Balance;
            model.Accounts       = await _AcctRepo.Get(userManager.GetUserId(User));

            AppUser user = _UserRepo.Get(userManager.GetUserId(User));

            if (ModelState.IsValid)
            {
                if (model.PaymentFromAccount)
                {
                    await _UserRepo.OverdraftPayment(user, model.Amount, model.AccountID);
                }
                else
                {
                    await _UserRepo.OverdraftPayment(user, model.Amount);
                }
            }
            return(View(model));
        }