Пример #1
0
        public static void ResetTimeResultsfromJson(sc2dsstatsContext context, ILogger logger)
        {
            var results = JsonSerializer.Deserialize <List <DsTimeResultValue> >(File.ReadAllText("/data/results.json"));

            logger.LogInformation($"Got {results.Count} from json file.");

            var timeresults = context.DsTimeResults.ToList();

            timeresults.ForEach(f => { f.Count = 0; f.Wins = 0; f.MVP = 0; f.Duration = 0; f.Kills = 0; f.Army = 0; });
            context.SaveChanges();

            var participants = context.Participants.ToList();

            participants.ForEach(f => { f.Count = 0; f.Wins = 0; });
            context.SaveChanges();

            UploadService.CollectTimeResults2(context, logger, results);
        }