public async Task <IActionResult> Edit(int id, [Bind("Id,AccountId,NumberOfYears")] CalculatedBalance calculatedBalance) { if (id != calculatedBalance.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(calculatedBalance); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CalculatedBalanceExists(calculatedBalance.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AccountId"] = new SelectList(_context.Account, "Id", "Id", calculatedBalance.AccountId); return(View(calculatedBalance)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerName,CustomerNumber,BankId")] 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))); } ViewData["BankId"] = new SelectList(_context.Bank, "Id", "Id", customer.BankId); return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,BankName,FixedDepositPercentage")] Bank bank) { if (id != bank.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bank); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BankExists(bank.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(bank)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,AccountNumber,Balance,CustomerId")] 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.Set <Customer>(), "Id", "Id", account.CustomerId); return(View(account)); }