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)); }
public async Task <IActionResult> Edit(int id, [Bind("AccountID,Address,Password,Rememberme")] Account account) { if (id != account.AccountID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(account); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AccountExists(account.AccountID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(account)); }