Пример #1
0
        /// <summary>
        /// Get the finished matches of a competition.
        /// </summary>
        /// <param name="service">Football service.</param>
        static public void Matches(FootballService service)
        {
            // Get the Ligue 1 by its code
            var ligue1 = service.GetCompetition("FL1");

            // Get every finished matches of the Ligue 1
            var matchRequest = service.GetMatches(ligue1, Status.FINISHED);

            // Check if there is a message, which means something went wrong
            if (matchRequest.IsValid)
            {
                // Display ever matches
                foreach (var match in matchRequest.Matches)
                {
                    Console.WriteLine($"{match.HomeTeam} vs {match.AwayTeam} ({match.Score.FullTime}) | {match.UTCDate}");
                }
            }

            else
            {
                Console.WriteLine($"Failed to send match request : {matchRequest.Message}");
            }

            // Separatation
            DisplayLine();
        }
Пример #2
0
        /// <summary>
        /// Get the standings of a competition.
        /// </summary>
        /// <param name="service">Football service.</param>
        static public void Standings(FootballService service)
        {
            // Get the Premiere League by uts code
            var premiereLeague = service.GetCompetition("PL");

            // Get the standing for the Premiere League
            var standingRequest = service.GetStandings(premiereLeague);

            // Check if there is a message, which means something went wrong
            if (standingRequest.IsValid)
            {
                // Display the table of the Premiere League
                foreach (var table in standingRequest.Standings[0].Table) // First standing is the classic standing, there is 3 standings : Full, Home and Away.
                {
                    Console.WriteLine($"{table.Position}. {table.Team} | Points: {table.Points} ({table.GoalDifference})");
                }
            }

            else
            {
                Console.WriteLine($"Failed to send standing request : {standingRequest.Message}");
            }

            // Separatation
            DisplayLine();
        }