public static IEnumerable <GameTableType> ToGameTableEntity(this ScheduleEntity schedule)
 {
     foreach (var week in schedule.Weeks)
     {
         foreach (var game in week.Games)
         {
             yield return(new GameTableType()
             {
                 RowKey = game.Id.ToString(),
                 Scheduled = game.Scheduled,
                 Home = game.Home,
                 Away = game.Away,
                 Status = game.Status,
                 HomePoints = game.HomePoints,
                 AwayPoints = game.AwayPoints,
                 //Week
                 PartitionKey = week.Id.ToString(),
                 WeekNumber = week.Number,
                 //season
                 Season = schedule.Season.ToString(),
                 Type = schedule.Type
             });
         }
     }
 }
Exemple #2
0
        private async Task <ScheduleEntity> GetSportRadarSchedule()
        {
            var url  = string.Format(Keys.SportsRadar.ScheduleUrlFormat, DateTime.Today.Year, ApiKey);
            var json = await HttpClient.GetStringAsync(url);

            var radarSchedule = ScheduleEntity.FromJson(json);

            return(radarSchedule);
        }
 public static IEnumerable <WeekTableType> ToWeekTableEntity(this ScheduleEntity schedule)
 {
     return(schedule.Weeks.Select(week => new WeekTableType()
     {
         RowKey = week.Id.ToString(),
         PartitionKey = schedule.Season.ToString(),
         Type = schedule.Type,
         Number = week.Number
     }));
 }
 public static string ToJson(this ScheduleEntity self) => JsonConvert.SerializeObject(self, Converter.Settings);
Exemple #5
0
 private List <WeekTableType> GetWeeks(ScheduleEntity radarSchedule)
 {
     return(radarSchedule.ToWeekTableEntity().ToList());
 }
Exemple #6
0
 private List <GameTableType> GetGames(ScheduleEntity radarSchedule)
 {
     return(radarSchedule.ToGameTableEntity().ToList());
 }