public APIMatch(Match match) { this.Id = match.Id; this.Date = match.Date; if (match.HomeTeam != null) this.HomeTeam = match.HomeTeam.Id; if (match.AwayTeam != null) this.AwayTeam = match.AwayTeam.Id; this.HomeTeamScore = match.HomeTeamScore; this.AwayTeamScore = match.AwayTeamScore; if (match.League != null) this.League = match.League.Id; }
internal IList<Match> FromLeaguesMatches(LeaguesMatchesResponse apiData) { List<Match> ret = new List<Match>(); foreach (var apiMatch in apiData.Fixtures) { var x = new Match(); var temp = apiMatch.Links.Self.Href.Split('/'); x.ApiId = Int32.Parse(temp[temp.Length - 1]); x.HomeTeam = new Team { Name = apiMatch.HomeTeamName }; x.AwayTeam = new Team { Name = apiMatch.AwayTeamName }; x.AwayTeamScore = apiMatch.Result.GoalsAwayTeam; x.HomeTeamScore = apiMatch.Result.GoalsHomeTeam; x.Date = DateTime.Parse(apiMatch.Date, null, System.Globalization.DateTimeStyles.RoundtripKind); ret.Add(x); } return ret; }
public virtual int CompareTo(Match o) { return Date.CompareTo(o.Date); }
internal IList<Match> FromTeamsMatches(TeamsMatchesResponse apiData) { List<Match> ret = new List<Match>(); foreach(var apiMatch in apiData.Fixtures) { var x = new Match(); var temp = apiMatch.Links.Self.Href.Split('/'); var leagueId = apiMatch.Links.Soccerseason.Href.Split('/'); var y = apiMatch.Links.AwayTeam.Href.Split('/'); var z = apiMatch.Links.HomeTeam.Href.Split('/'); var aid = Int32.Parse(y[y.Length - 1]); var hid = Int32.Parse(z[z.Length - 1]); x.ApiId = Int32.Parse(temp[temp.Length - 1]); x.HomeTeam = new Team { Name = apiMatch.HomeTeamName, ApiId=hid }; x.AwayTeam = new Team { Name = apiMatch.AwayTeamName, ApiId=aid }; x.AwayTeamScore = apiMatch.Result.GoalsAwayTeam; x.HomeTeamScore = apiMatch.Result.GoalsHomeTeam; x.Date = DateTime.Parse(apiMatch.Date, null, System.Globalization.DateTimeStyles.RoundtripKind); x.League = new League { ApiId = Int32.Parse(leagueId[leagueId.Length - 1]) }; ret.Add(x); } return ret; }