public async Task <IActionResult> Edit(int id, [Bind("OrderId,OrderDate,CustomerId")] Orders orders) { if (id != orders.OrderId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(orders); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrdersExists(orders.OrderId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "Address", orders.CustomerId); return(View(orders)); }
public async Task <IActionResult> Edit(int id, [Bind("CustomerId,Forename,Surname,Address")] Customers customers) { if (id != customers.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomersExists(customers.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customers)); }
public async Task <IActionResult> Edit(int id, [Bind("OrderId,ProductId,Quantity")] OrderItems orderItems) { if (id != orderItems.OrderId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(orderItems); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderItemsExists(orderItems.OrderId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(orderItems)); }
public async Task <IActionResult> Edit(int id, [Bind("ProductId,ProductName,Category,Price,ReOrderLevel,StockLevel")] Products products) { if (id != products.ProductId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(products); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductsExists(products.ProductId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(products)); }