public IActionResult Edit(int id, [Bind("ID,GenreName")] Genre genre) { if (id != genre.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(genre); _context.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GenreExists(genre.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(genre)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Age")] Test test) { if (id != test.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(test); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TestExists(test.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(test)); }