Example #1
0
        private static async Task <bool> UpdateMatch(BasketballHttpClient basketballClient, int matchId, Match updatedMatch)
        {
            Console.WriteLine("Updating match with id: " + matchId);
            Console.WriteLine(JsonSerializer.Serialize(updatedMatch, _serializerSettings));

            var matchUpdateResult = await basketballClient.UpdateMatch(matchId, updatedMatch);

            if (!matchUpdateResult.IsSuccessStatusCode)
            {
                WriteRed("Match not updated.");
                Console.WriteLine($"{matchUpdateResult.StatusCode}:{await matchUpdateResult.Content.ReadAsStringAsync()}");
                Console.WriteLine();
                return(false);
            }

            WriteGreen("Match updated.");
            Console.WriteLine();
            return(true);
        }