public async Task <IActionResult> Edit(int id, [Bind("Id,PartName,PartCost")] Part part) { if (id != part.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(part); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PartExists(part.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(part)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Item item) { if (id != item.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(item); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItemExists(item.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(item)); }