public IActionResult Edit(int id, League league) { if (id != league.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _leagues.Update(league); } catch (DbUpdateConcurrencyException) { if (!LeagueExists(league.Id)) { return(NotFound()); } else { throw; } } } return(RedirectToAction(nameof(Index))); }