public async Task <IActionResult> Edit(int id, [Bind("StoreId,ProductId,ProductName,ProductCount,SinventoryId")] StoreInventory storeInventory) { if (id != storeInventory.SinventoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(storeInventory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoreInventoryExists(storeInventory.SinventoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ProductId"] = new SelectList(_context.Products, "ProductId", "ProductId", storeInventory.ProductId); ViewData["StoreId"] = new SelectList(_context.Store, "StoreId", "StoreId", storeInventory.StoreId); return(View(storeInventory)); }
public async Task <IActionResult> Edit(int id, [Bind("ProductId,ProductName,ProductPrice")] 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("CustomerEmail,OrderDate,FullProductCount,TotalPrice,CustomerOrderId,ProductName")] BalloonParty.DataAccess.SQLData.CustomerOrders customerOrders) { if (id != customerOrders.CustomerOrderId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customerOrders); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerOrdersExists(customerOrders.CustomerOrderId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerEmail"] = new SelectList(_context.Customer, "EmailAddress", "EmailAddress", customerOrders.CustomerEmail); return(View(customerOrders)); }