Exemplo n.º 1
0
        public async Task <Uri> CreatePlayerAsync(PlayerOriginModel player)
        {
            HttpResponseMessage response = await _client.PostAsJsonAsync(
                "api/Players", player);

            response.EnsureSuccessStatusCode();

            // return URI of the created resource.
            return(response.Headers.Location);
        }
Exemplo n.º 2
0
        public async Task <PlayerOriginModel> UpdatePlayerAsync(PlayerOriginModel Player)
        {
            HttpResponseMessage response = await _client.PutAsJsonAsync(
                $"api/Players/{Player.name}", Player);

            response.EnsureSuccessStatusCode();

            // Deserialize the updated Player from the response body.
            Player = await response.Content.ReadAsAsync <PlayerOriginModel>();

            return(Player);
        }
Exemplo n.º 3
0
 public void ShowPlayer(PlayerOriginModel player)
 {
     Console.WriteLine($"Name: {player.name}\tTeam: " +
                       $"{player.team_name}\tTeamAcronym: {player.team_acronym}");
 }