public async Task <ActionResult <LeaderBoard> > PostLeaderBoard(LeaderBoard leaderBoard) { _context.LeaderBoard.Add(leaderBoard); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLeaderBoard", new { id = leaderBoard.PlayerId }, leaderBoard)); }
public async Task <IActionResult> PutLeaderBoard(int id, LeaderBoard leaderBoard) { if (id != leaderBoard.PlayerId) { return(BadRequest()); } _context.Entry(leaderBoard).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LeaderBoardExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }