コード例 #1
0
        public IEnumerable <PlayoffPlayerInfoEntity> GetBestPerRound(int round)
        {
            var playoffPlayerInfoCache = (List <PlayoffPlayerInfo>)_caching.GetCachedItem("PlayoffPlayerInfoGetAll");

            List <PlayoffPlayerInfo> playoffPlayerInfo = null; // This one ok as a list since it is not .Tolist() again

            if (playoffPlayerInfoCache == null)
            {
                playoffPlayerInfo = _unitOfWork.PlayoffPlayerInfoRepository.GetAll().ToList();
                _caching.AddToCache("PlayoffPlayerInfoGetAll", playoffPlayerInfo);
                if (!playoffPlayerInfo.Any())
                {
                    return(null);
                }
            }
            else
            {
                playoffPlayerInfo = playoffPlayerInfoCache;
            }

            var playoffPlayerInfoOrderedByRound = playoffPlayerInfo
                                                  .Where(x => x.I_Round == round && x.L_Traded == false && x.C_UserEmail != String.Empty)
                                                  .OrderByDescending(p => p.I_Point)
                                                  .ThenBy(g => g.I_Game).ToList();

            Mapper.CreateMap <PlayoffPlayerInfo, PlayoffPlayerInfoEntity>();
            var playoffPlayerInfoEntities = Mapper.Map <List <PlayoffPlayerInfo>, List <PlayoffPlayerInfoEntity> >(playoffPlayerInfoOrderedByRound);

            return(playoffPlayerInfoEntities);
        }
コード例 #2
0
        public PlayoffUserInfoEntity GetTopBestDay()
        {
            var userInfoCache = (IEnumerable <PlayoffUserInfo>)_caching.GetCachedItem("PlayoffPlayoffUserInfoGetAll");

            PlayoffUserInfo userInfoTopDay;

            if (userInfoCache == null)
            {
                userInfoCache = _unitOfWork.PlayoffUserInfoRepository.GetAll();
                _caching.AddToCache("PlayoffPlayoffUserInfoGetAll", userInfoCache);
                userInfoTopDay = userInfoCache.OrderByDescending(u => u.I_BestDay).FirstOrDefault();
                if (userInfoTopDay == null)
                {
                    return(null);
                }
            }
            else
            {
                userInfoTopDay = userInfoCache.OrderByDescending(u => u.I_BestDay).FirstOrDefault();
            }

            Mapper.CreateMap <PlayoffUserInfo, PlayoffUserInfoEntity>();
            var userInfoEntity = Mapper.Map <PlayoffUserInfo, PlayoffUserInfoEntity>(userInfoTopDay);

            return(userInfoEntity);
        }
コード例 #3
0
        public IEnumerable <PoolLastYearEntity> GetAll()
        {
            var pastPoolInfoCache = (IEnumerable <PoolLastYear>)_caching.GetCachedItem("PastPoolInfoGetAll");

            IEnumerable <PoolLastYear> pastPoolInfo = null;

            if (pastPoolInfoCache == null)
            {
                pastPoolInfo = _unitOfWork.PoolLastYearRepository.GetAll();
                _caching.AddToCache("PastPoolInfoGetAll", pastPoolInfo);
                if (!pastPoolInfo.Any())
                {
                    return(null);
                }
            }
            else
            {
                pastPoolInfo = pastPoolInfoCache;
            }

            Mapper.CreateMap <PoolLastYear, PoolLastYearEntity>();
            var poolLastYearEntities = Mapper.Map <List <PoolLastYear>, List <PoolLastYearEntity> >((List <PoolLastYear>)pastPoolInfo);

            return(poolLastYearEntities);
        }
コード例 #4
0
        public DateTime GetLastUpdate()
        {
            var lastUpdateCache = _caching.GetCachedItem("LastUpdate");

            DateTime lastUpdate;

            if (lastUpdateCache == null)
            {
                lastUpdate = _unitOfWork.GetLastUpdate();
                _caching.AddToCache("LastUpdate", lastUpdate);
            }
            else
            {
                lastUpdate = (DateTime)lastUpdateCache;
            }

            return(lastUpdate);
        }