public async Task <IActionResult> Edit(int id, [Bind("LogId,OrderId,ProductId,ProductQty,SubTotal")] OrderLog orderLog) { if (id != orderLog.LogId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(orderLog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderLogExists(orderLog.LogId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["OrderId"] = new SelectList(_context.Orders, "OrderId", "OrderId", orderLog.OrderId); ViewData["ProductId"] = new SelectList(_context.Products, "ProductId", "ProductId", orderLog.ProductId); return(View(orderLog)); }
public async Task <IActionResult> Edit(int id, [Bind("StoreId,StoreName,StoreLocation")] NuggetStores nuggetStores) { if (id != nuggetStores.StoreId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(nuggetStores); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!NuggetStoresExists(nuggetStores.StoreId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(nuggetStores)); }
public async Task <IActionResult> Edit(int id, [Bind("ProductId,ProductName,ProductPrice,Inventory")] 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)); }
public async Task <IActionResult> Edit(int id, [Bind("OrderId,DateTimeStamp,StoreId,CustomerId,Total")] 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", "PreferredStore", orders.CustomerId); ViewData["StoreId"] = new SelectList(_context.NuggetStores, "StoreId", "StoreName", orders.StoreId); return(View(orders)); }
public async Task <IActionResult> Edit(int id, [Bind("CustomerId,FirstName,LastName,PreferredStore")] 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))); } ViewData["StoreName"] = new SelectList(_context.NuggetStores, "PreferredStore", "StoreName", customers.PreferredStore); return(View(customers)); }