Exemplo n.º 1
0
        public async Task <IActionResult> ScheduleBillPay(BillPayFormModel model)
        {
            Account account = await _acctRepo.GetAcctBpay(model.SenderAccountNumber);

            Payee payee = await _payeeRepo.Get(model.DestinationID);

            this.CheckAmountError(model.Amount);
            this.CanProceed(account, model.Amount);

            if (!ModelState.IsValid)
            {
                ViewBag.Payees = await _payeeRepo.GetAll();

                ViewBag.Accounts = await this.GetAccountsForViewBag();

                return(View(model));
            }

            if (account == null || payee == null)
            {
                return(NotFound());
            }

            string billpayJson = JsonConvert.SerializeObject(model);

            HttpContext.Session.SetString("BillpayJson", billpayJson);

            return(RedirectToAction(nameof(Confirm)));
        }
 public Payee Get(int id)
 {
     return(_repo.Get(id));
 }