public async Task <IActionResult> Edit(int id, [Bind("Id,CustomerId,TotalPrice")] Order order) { if (id != order.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(order.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CustomerId"] = new SelectList(_context.Customer, "Id", "Name", order.CustomerId); return(View(order)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Username,Password")] Manager manager) { if (id != manager.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(manager); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ManagerExists(manager.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(manager)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Description,Price")] Product product) { if (id != product.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(product.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(product)); }