Ejemplo n.º 1
0
        public static MatchInfoModel Create(FussballTippApp.SvcFussballDB.Matchdata match)
        {
            var matchModelObj = new MatchInfoModel();

            matchModelObj.MatchId       = match.matchID;
            matchModelObj.KickoffTime   = match.matchDateTime;
            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;

            if (match.matchResults != null && match.matchResults.Any())
            {
                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);
        }
Ejemplo n.º 2
0
        public MatchDataModel GetMatchData(int matchId)
        {
            string CACHE_MATCH_TAG = CACHE_MATCH_PREFIX + _leagueTag + matchId.ToString();

            FussballTippApp.SvcFussballDB.Matchdata m = null;
            if (_cache.IsSet(CACHE_MATCH_TAG))
            {
                m = (FussballTippApp.SvcFussballDB.Matchdata)_cache.Get(CACHE_MATCH_TAG);
                _cacheHits++;
            }
            else
            {
                m = _client.GetMatchByMatchID(matchId);
                _cache.Set(CACHE_MATCH_TAG, m, CACHE_DURATION);
                _remoteHits++;
            }

            return(Create(m));
        }
Ejemplo n.º 3
0
        public MatchDataModel GetLastMatch()
        {
            string CACHE_LAST_MATCH_TAG = "cacheLastGame" + _leagueTag;
            string CACHE_MATCH_TAG      = CACHE_MATCH_PREFIX + _leagueTag;

            FussballTippApp.SvcFussballDB.Matchdata m = null;
            if (_cache.IsSet(CACHE_LAST_MATCH_TAG))
            {
                m = (FussballTippApp.SvcFussballDB.Matchdata)_cache.Get(CACHE_LAST_MATCH_TAG);
                _cacheHits++;
            }
            else
            {
                m = _client.GetLastMatch(_leagueTag);
                _cache.Set(CACHE_LAST_MATCH_TAG, m, CACHE_DURATION);
                _cache.Set(CACHE_MATCH_TAG + m.matchID.ToString(), m, CACHE_DURATION);
                _remoteHits++;
            }

            return(Create(m));
        }