public async Task <IActionResult> Edit(int id, [Bind("O_ID,P_Name,Quantity,CAddress")] Order order) { if (id != order.O_ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(order.O_ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(order)); }
public async Task <IActionResult> Edit(int id, [Bind("P_ID,P_Name,Quantity,Model")] Product product) { if (id != product.P_ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(product.P_ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Edit(int id, [Bind("Name,Phone,address,ID,O_ID")] Customer customer) { if (id != customer.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["O_ID"] = new SelectList(_context.Order, "O_ID", "P_Name", customer.O_ID); return(View(customer)); }