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> Create([Bind("Id,FirstName,MiddleNameInitial,LastName,Address,PhoneNumber,Email,DOB,UserName,Password")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); await _context.SaveChangesAsync(); var Id = customer.Id; return(RedirectToAction("Details", new { @id = Id })); } return(View(customer)); }
public async Task <IActionResult> Create([Bind("ID,AccountNumber,AccountBalance,AccountType,Activated,CustomerID,MaturityDate,InterestRate")] CheckingAccount checkingAccount) { if (ModelState.IsValid) { _context.Add(checkingAccount); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerID"] = new SelectList(_context.Customers, "Id", "Address", checkingAccount.CustomerID); return(View(checkingAccount)); }