public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerId,StaffId,CarId")] Buy buy) { if (id != buy.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(buy); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BuyExists(buy.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CarId"] = new SelectList(_context.Car, "Id", "Id", buy.CarId); ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "Id", buy.CustomerId); ViewData["StaffId"] = new SelectList(_context.Staff, "Id", "Id", buy.StaffId); return(View(buy)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Customer_Name,DOB,Customer_Address,Customer_Contact")] 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)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Car_Name,Car_Make,Car_Date,Car_Price")] Car car) { if (id != car.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(car); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CarExists(car.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(car)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Staff_Name,Staff_Last_Name,Staff_Address,Staff_Contact")] Staff staff) { if (id != staff.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(staff); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StaffExists(staff.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(staff)); }