public async Task <IActionResult> PutChampionship([FromRoute] int id, [FromBody] Championship championship) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != championship.ChampionshipID) { return(BadRequest()); } _context.Entry(championship).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ChampionshipExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutPlayer([FromRoute] int id, [FromBody] Player player) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != player.PlayerID) { 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> PutFootballTeam([FromRoute] int id, [FromBody] FootballTeam footballTeam) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != footballTeam.FootballTeamID) { return(BadRequest()); } _context.Entry(footballTeam).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FootballTeamExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }