public async Task <IActionResult> Edit(int id, [Bind("Id,Balance,InterestRate,AccountNumber,IsClosed,AccType,Term,IsMature")] 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))); } return(View(account)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Details,Date")] Transaction transaction) { if (id != transaction.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(transaction); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TransactionExists(transaction.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(transaction)); }
public async Task <IActionResult> Edit(int id, [Bind("StaffNo,Fname,Lname,Sex,DateOfBirth,Salary,StaffBranchNo")] Staff staff) { if (id != staff.StaffNo) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(staff); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StaffExists(staff.StaffNo)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["StaffBranchNo"] = new SelectList(_context.Branch, "BranchNo", "City", staff.StaffBranchNo); return(View(staff)); }
public async Task <IActionResult> Edit(int id, [Bind("ClientNo,Fname,Lname,Sex,DateOfBirth,PhoneNumber")] Client client) { if (id != client.ClientNo) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(client); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClientExists(client.ClientNo)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(client)); }
public async Task <IActionResult> Edit(int id, [Bind("DepositNo,Cash,PercentPerYear,DateOfBegin,DateOfEnd,Commentary,DepStaffNo,DepClientNo")] Deposit deposit) { if (id != deposit.DepositNo) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(deposit); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepositExists(deposit.DepositNo)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["DepClientNo"] = new SelectList(_context.Client, "ClientNo", "Fname", deposit.DepClientNo); ViewData["DepStaffNo"] = new SelectList(_context.Staff, "StaffNo", "Fname", deposit.DepStaffNo); return(View(deposit)); }
public async void UpdateBranchData(Branch branch) { try { _bankingContext.Update(branch); await _bankingContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { //if (!BranchExists(branch.BranchNo)) //{ // return NotFound(); //} //else //{ throw; //} } }
public async Task UpdateAsync(Login login, string userId) { login.UserID = userId; _context.Update(login); await _context.SaveChangesAsync(); }
public async Task UpdateAsync(Customer customer, int customerID) { customer.CustomerID = customerID; _context.Update(customer); await _context.SaveChangesAsync(); }