public static List <RankingRace> DownloadRankingRaces(List <string> months) { List <RankingRace> races = new List <RankingRace>(); // RankingRaceRepository rep = new RankingRaceRepository(new LiveRankingDb()); foreach (string month in months) { string response = ApiCalls.GetRankingEventsPageContent(month); races.AddRange(ParseRankingRaces(response)); } return(races); }
public static List <RaceExport> ExtractResults(List <RankingRace> races) { List <RaceExport> racesExport = new List <RaceExport>(); foreach (var race in races) { if (race.HasResults) { string results = ApiCalls.GetEventResults(race.RankingRaceOrisId); RaceExport raceExport = new RaceExport(); List <Result> resList = new List <Result>(); JObject jsonRace = JObject.Parse(results); raceExport.Method = (string)jsonRace["Method"]; raceExport.Format = (string)jsonRace["Format"]; raceExport.Status = (string)jsonRace["Status"]; raceExport.ExportCreated = (string)jsonRace["ExportCreated"]; foreach (var result in jsonRace["Data"].Children()) { Result res = new Result(); res.ID = (string)result.First["ID"]; res.ClassID = (string)result.First["ClassID"]; res.ClassDesc = (string)result.First["ClassDesc"]; res.Sort = (string)result.First["Sort"]; res.Place = (string)result.First["Place"]; res.Name = (string)result.First["Name"]; res.RegNo = (string)result.First["RegNo"]; res.Lic = (string)result.First["Lic"]; res.ClubNameResults = (string)result.First["ClubNameResults"]; res.Time = (string)result.First["Time"]; res.Loss = (string)result.First["Loss"]; res.StartTime = (string)result.First["StartTime"]; res.FinishTime = (string)result.First["FinishTime"]; res.UserID = (string)result.First["UserID"]; res.ClubID = (string)result.First["ClubID"]; resList.Add(res); } raceExport.Data = resList; racesExport.Add(raceExport); } } return(racesExport); }