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