public async Task <IActionResult> Edit(int id, [Bind("Id,Address,Contact,Email")] Store store) { if (id != store.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(store); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoreExists(store.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(store)); }
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,CustomerId,StaffId,StoreId,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); ViewData["StoreId"] = new SelectList(_context.Store, "Id", "Id", buy.StoreId); return(View(buy)); }
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)); }