예제 #1
0
        public IActionResult Edit(int id, [Bind("AccountNumber,EmailAddress,FirstName,LastName,CreatedDate,YearsInPeriod,Income,Interest,PercentOfSalarySaved,ExpectedInflation")] Account account)
        {
            if (id != account.AccountNumber)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    Constructor.editAccount(account);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Constructor.AccountExists(account.AccountNumber))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(account));
        }
예제 #2
0
 private bool AccountExists(int id)
 {
     return(Constructor.AccountExists(id));
 }