Example #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));
        }
Example #2
0
 private bool AccountExists(int id)
 {
     return(Constructor.AccountExists(id));
 }