示例#1
0
        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);
        }
示例#2
0
 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;
 }