Beispiel #1
0
        private async Task Init()
        {
            var context = new DataContext();

            if (context.Matches.Count() > 0)
            {
                return;
            }

            var matches = await apiClient.GetLastestMatches();

            var lastest = matches.OrderByDescending(_ => _.match_seq_num).FirstOrDefault();

            var date  = DateTimeOffset.FromUnixTimeSeconds(lastest.start_time).UtcDateTime;
            var match = new Data.Models.Match()
            {
                match_id = lastest.match_id, match_number = lastest.match_seq_num, date = date, valid = false
            };

            context.Matches.Add(match);
            await context.SaveChangesAsync();
        }