public async Task <IActionResult> Edit(int id, [Bind("ShippingID,AddressNum,AddressStreet,AddressCity,AddressState,AddressZipCode")] Shipping shipping) { if (id != shipping.ShippingID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(shipping); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ShippingExists(shipping.ShippingID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(shipping)); }
public async Task <IActionResult> Edit(string id, [Bind("Username,Password,CustomerID")] UserAccount userAccount) { if (id != userAccount.Username) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(userAccount); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserAccountExists(userAccount.Username)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerID"] = new SelectList(_context.Customers, "CustomerID", "CustomerID", userAccount.CustomerID); return(View(userAccount)); }
public async Task <IActionResult> Edit(int id, [Bind("LocationID,Name,AddressNum,AddressStreet,AddressCity,AddressState,AddressZipCode,Description")] Location location) { if (id != location.LocationID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(location); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocationExists(location.LocationID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(location)); }
public async Task <IActionResult> Edit(int id, [Bind("OrderID,CustomerID,LocationID,OrderTime,BillingID,ShippingID")] Order order) { if (id != order.OrderID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(order.OrderID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BillingID"] = new SelectList(_context.BillingInformation, "BillingID", "AddressCity", order.BillingID); ViewData["CustomerID"] = new SelectList(_context.Customers, "CustomerID", "CustomerID", order.CustomerID); ViewData["LocationID"] = new SelectList(_context.Locations, "LocationID", "LocationID", order.LocationID); ViewData["ShippingID"] = new SelectList(_context.ShippingInformation, "ShippingID", "AddressCity", order.ShippingID); return(View(order)); }
public async Task <IActionResult> Edit(int id, [Bind("CustomerId,FirstName,LastName,Email")] Customer customer) { if (id != customer.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("ProductID,Name,Price,Type,Description")] Product product) { if (id != product.ProductID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(product.ProductID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Edit(int id, [Bind("BillingID,NameOnCard,CardNumber,ExpirationMonth,ExpirationYear,SecurityCode,AddressNum,AddressStreet,AddressCity,AddressState,AddressZipCode")] Billing billing) { if (id != billing.BillingID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(billing); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BillingExists(billing.BillingID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(billing)); }