public async Task <IActionResult> Edit(int id, [Bind("ProductId,ProductName,Description,Price,Quantity,Category")] Product product) { if (id != product.ProductId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(product.ProductId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Edit(int id, [Bind("Created,Id,Name,Description")] InventoryItem inventoryItem) { if (id != inventoryItem.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inventoryItem); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InventoryItemExists(inventoryItem.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(inventoryItem)); }