public async Task <IActionResult> IEdit(int id, [Bind("ItemId,Name,ShortDescription,LongDescription,Price,ImageUrl,ImageThumbnailUrl,FeaturedItem,Amount,InStock,Category")] Inventory inventory) { if (id != inventory.ItemId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(inventory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InventoryExists(inventory.ItemId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(inventory)); }
public async Task <IActionResult> Edit(int id, [Bind("FName,LName,CustomerNumber,Phone,BAddress,SAddress,Email,Balance")] Customer customer) { if (id != customer.CustomerNumber) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customer); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.CustomerNumber)) { return(NotFound()); //base; } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customer)); }