private static MatchDataModel Create(Matchdata match) { var matchModelObj = new MatchDataModel { MatchId = match.matchID, GroupId = match.groupOrderID, KickoffTime = match.matchDateTime, KickoffTimeUtc = match.matchDateTimeUTC, HomeTeamId = match.idTeam1, AwayTeamId = match.idTeam2, HomeTeamScore = match.pointsTeam1, AwayTeamScore = match.pointsTeam2, HomeTeamIcon = match.iconUrlTeam1, AwayTeamIcon = match.iconUrlTeam2, HomeTeam = match.nameTeam1, AwayTeam = match.nameTeam2, IsFinished = match.matchIsFinished, LeagueShortcut = match.leagueShortcut }; if (match.matchResults != null && match.matchResults.Count > 0) { var result = (from r in match.matchResults orderby r.resultTypeId descending select r).FirstOrDefault(); if (result == null) { return(matchModelObj); } matchModelObj.HomeTeamScore = result.pointsTeam1; matchModelObj.AwayTeamScore = result.pointsTeam2; } return(matchModelObj); }
public static void Match(string name) { Matchdata data = new Matchdata { type = "match", name = name }; string json = JsonUtility.ToJson(data); client.SendMessage(Encoding.UTF8.GetBytes(json)); }