Ejemplo n.º 1
0
        public IActionResult Edit(int id,
                                  [Bind("AccountNumber,AccountType,EmailAddress")] Account account)
        {
            if (id != account.AccountNumber)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    BankFactory.EditAccount(account);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (BankFactory.AccountExists(account.AccountNumber))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(account));
        }