public async Task <IActionResult> Edit(int id, [Bind("ID,AccountNumber,AccountBalance,AccountType,Activated,CustomerID,InterestRate")] Account account) { if (id != account.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(account); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AccountExists(account.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerID"] = new SelectList(_context.Customers, "Id", "Id", account.CustomerID); return(View(account)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,MiddleNameInitial,LastName,Address,PhoneNumber,Email,DOB,UserName,Password")] Customer customer) { if (id != customer.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }