Esempio n. 1
0
 public ActionResult AccountsWithdrawn(AccountWithdrawn model)
 {
     if (!ModelState.IsValid)
     {
         return(View(model));
     }
     if (!_accountService.Withdrawn(model.accountId, model.ammount))
     {
         ModelState.AddModelError("ammount", "The ammount will take the customer below there overdraft.");
         return(View(model));
     }
     return(RedirectToAction("CustomerAccounts", new { customerId = model.customerId }));
 }
Esempio n. 2
0
        public ActionResult AccountsWithdrawn(int accountId, int customerId)
        {
            if (!_customerService.CustomerExist(customerId))
            {
                return(RedirectToAction("CustomerAccounts", new { customerId = customerId }));
            }
            var accounts = _accountService.GetAccountsForACustomer(customerId);
            var account  = accounts.SingleOrDefault(x => x.Id == accountId);

            if (account == null)
            {
                return(RedirectToAction("CustomerAccounts", new { customerId = customerId }));
            }
            var model = new AccountWithdrawn()
            {
                customerId  = customerId,
                accountId   = account.Id,
                accountName = account.Name
            };

            return(View(model));
        }