Example #1
0
        public IEnumerable <FixtureFuture> GetFromClientFixtureFutures(ExternalLeagueCode externalLeagueCode, string timeFrame)
        {
            IEnumerable <FixtureFuture> result = null;
            var idSeason = GetIdSeason(externalLeagueCode);

            if (idSeason > 0)
            {
                FixturesResponse fixturesResult;
                try
                {
                    fixturesResult = _competitionResultSingleton.FootballDataOrgApiGateway.GetFixturesResultAsync(idSeason, timeFrame).Result;
                }
                catch (AggregateException ex)
                {
                    LogAggregateException(ex);
                    fixturesResult = new FixturesResponse {
                        Fixtures = new List <Fixture> {
                            new Fixture {
                                HomeTeamName = EntityConstants.PotentialTimeout
                            }
                        }
                    };
                }
                if (fixturesResult != null)
                {
                    result = GetFixtureFutures(fixturesResult);//.OrderBy(x => new { x.Date, x.HomeName });
                }
            }
            return(result);
        }
Example #2
0
        public async Task <FixturesResponse> GetFixturesAsync()
        {
            string urlPath             = "/v1/fixtures" + "?sportId=29";
            HttpResponseMessage result = await this.GetHttpResponseAsync(urlPath);

            string content = await result.Content.ReadAsStringAsync();

            FixturesResponse fixturesResponse = JsonConvert.DeserializeObject <FixturesResponse>(content);

            return(fixturesResponse);
        }
        /// <summary>
        /// Загрузга данных о событиях по футболу с пинакл
        /// </summary>
        public void InitilizeEvents()
        {
            FixturesResponse response = this.pinnacleClient.GetFixturesAsync().Result;

            foreach (PinnacleLeague league in response.Leagues)
            {
                foreach (PinnacleEvent pinnacleEvent in league.Events)
                {
                    this._events.Add(pinnacleEvent);
                }
            }
        }
Example #4
0
 private static IEnumerable <FixtureFuture> GetFixtureFutures(FixturesResponse fixturesResult)
 {
     if (!string.IsNullOrEmpty(fixturesResult?.Error))
     {
         return(new List <FixtureFuture>
         {
             new FixtureFuture
             {
                 HomeName = fixturesResult.Error
             }
         });
     }
     else
     {
         return(fixturesResult?.Fixtures?.Select(x => new FixtureFuture
         {
             AwayName = MapperHelper.MapExternalTeamNameToInternalTeamName(x.AwayTeamName),
             Date = MapperHelper.GetDate(x.Date, Thread.CurrentThread.CurrentCulture),
             HomeName = MapperHelper.MapExternalTeamNameToInternalTeamName(x.HomeTeamName),
             Time = MapperHelper.GetTime(x.Date, Thread.CurrentThread.CurrentCulture),
         }));
     }
 }
Example #5
0
 public void ff(FixturesResponse fr)
 {
 }