public async Task <IActionResult> Edit(int id, [Bind("Id,LocationId,CustomerId,OrderDate,Total")] Orders orders) { if (id != orders.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(orders); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrdersExists(orders.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customers, "Id", "FirstName", orders.CustomerId); ViewData["LocationId"] = new SelectList(_context.Locations, "Id", "Address", orders.LocationId); return(View(orders)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,CardNumber")] Customers customers) { if (id != customers.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomersExists(customers.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customers)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,LocationId,ProductId,Stock")] Inventory inventory) { if (id != inventory.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inventory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InventoryExists(inventory.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["LocationId"] = new SelectList(_context.Locations, "Id", "Address", inventory.LocationId); ViewData["ProductId"] = new SelectList(_context.Products, "Id", "Name", inventory.ProductId); return(View(inventory)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Address,City,State")] Locations locations) { if (id != locations.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(locations); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LocationsExists(locations.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(locations)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Category,Price")] Products products) { if (id != products.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(products); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductsExists(products.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(products)); }