public static MatchDataModel Create(FussballTippApp.SvcFussballDB.Matchdata match) { var matchModelObj = new MatchDataModel(); matchModelObj.MatchId = match.matchID; matchModelObj.GroupId = match.groupOrderID; matchModelObj.KickoffTime = match.matchDateTime; matchModelObj.KickoffTimeUTC = match.matchDateTimeUTC; matchModelObj.HomeTeamId = match.idTeam1; matchModelObj.AwayTeamId = match.idTeam2; matchModelObj.HomeTeamScore = match.pointsTeam1; matchModelObj.AwayTeamScore = match.pointsTeam2; matchModelObj.HomeTeamIcon = match.iconUrlTeam1; matchModelObj.AwayTeamIcon = match.iconUrlTeam2; matchModelObj.HomeTeam = match.nameTeam1; matchModelObj.AwayTeam = match.nameTeam2; matchModelObj.IsFinished = match.matchIsFinished; matchModelObj.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); }
private static MatchDataModel Create(WMTippApp.SvcFussballDB.Matchdata match) { var matchModelObj = new MatchDataModel(); matchModelObj.MatchId = match.matchID; matchModelObj.GroupId = match.groupOrderID; matchModelObj.KickoffTime = match.matchDateTime; matchModelObj.KickoffTimeUTC = match.matchDateTimeUTC; matchModelObj.HomeTeamId = match.idTeam1; matchModelObj.AwayTeamId = match.idTeam2; matchModelObj.HomeTeamScore = match.pointsTeam1; matchModelObj.AwayTeamScore = match.pointsTeam2; matchModelObj.HomeTeamIcon = match.iconUrlTeam1; matchModelObj.AwayTeamIcon = match.iconUrlTeam2; matchModelObj.HomeTeam = match.nameTeam1; matchModelObj.AwayTeam = match.nameTeam2; matchModelObj.IsFinished = match.matchIsFinished; matchModelObj.LeagueShortcut = match.leagueShortcut; if (match.matchResults != null && match.matchResults.Any()) { matchResult result = EvaluateResult(match.matchResults); matchModelObj.HasVerlaengerung = false; if (result != null) { matchModelObj.HomeTeamScore = result.pointsTeam1; matchModelObj.AwayTeamScore = result.pointsTeam2; } } return(matchModelObj); }