public async Task <IActionResult> PutTournament(int id, Tournament tournament) { if (id != tournament.TournamentID) { return(BadRequest()); } _context.Entry(tournament).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TournamentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutPlayer(int id, Player player) { if (id != player.ID) { return(BadRequest()); } _context.Entry(player).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlayerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("ID,Tag,EnrollmentDate")] Player player) { if (ModelState.IsValid) { _context.Add(player); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(player)); }