public async Task <IActionResult> Edit(int id, [Bind("Id,Name,SponsorId,Location,PrizeFund")] Tournament tournament) { if (id != tournament.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tournament); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TournamentExists(tournament.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["SponsorId"] = new SelectList(_context.Sponsor, "Id", "Name", tournament.SponsorId); return(View(tournament)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,TournametId,GameId")] TournamentGames tournamentGames) { if (id != tournamentGames.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tournamentGames); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TournamentGamesExists(tournamentGames.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["GameId"] = new SelectList(_context.Game, "Id", "Name", tournamentGames.GameId); ViewData["TournametId"] = new SelectList(_context.Tournament, "Id", "Location", tournamentGames.TournametId); return(View(tournamentGames)); }
public async Task <IActionResult> Edit(int id, int teamId, int gameId, string gameName, [Bind("Id,Name,Position,Info,EntranceDate")] Player player) { player.TeamId = teamId; if (id != player.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(player); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlayerExists(player.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index", "Players", new { id = teamId, gameId, gameName })); } return(RedirectToAction("Index", "Players", new { id = teamId, gameId, gameName })); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Info")] Game game) { if (id != game.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(game); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GameExists(game.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(game)); }