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(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)); }
public async Task <IActionResult> Create([Bind("LocationID,Name,AddressNum,AddressStreet,AddressCity,AddressState,AddressZipCode,Description")] Location location) { if (ModelState.IsValid) { _context.Add(location); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(location)); }
public async Task <IActionResult> Create([Bind("CustomerId,FirstName,LastName,Email")] Customer customer) { if (ModelState.IsValid) { _context.Add(customer); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customer)); }
public async Task <IActionResult> Create([Bind("ProductID,Name,Price,Type,Description")] Product product) { if (ModelState.IsValid) { _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Create([Bind("Username,Password,CustomerID")] UserAccount userAccount) { if (ModelState.IsValid) { _context.Add(userAccount); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CustomerID"] = new SelectList(_context.Customers, "CustomerID", "CustomerID", userAccount.CustomerID); return(View(userAccount)); }
public async Task <IActionResult> Create([Bind("OrderID,CustomerID,LocationID,OrderTime,BillingID,ShippingID")] Order order) { if (ModelState.IsValid) { _context.Add(order); await _context.SaveChangesAsync(); 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)); }