예제 #1
0
        public IEnumerable <Domain.Entities.GlobalSetting.ContactInformation> GetEnableOrDisables(bool enable = true, bool isCache = true)
        {
            if (!isCache)
            {
                return(_contactInfoRepository.FindBy(x => x.Status == (enable ? (int)Status.Enable : (int)Status.Disable), true));
            }

            var sbKey = new StringBuilder();

            sbKey.AppendFormat(CacheKey, "GetEnableOrDisables");
            sbKey.Append(enable);

            var key = sbKey.ToString();

            var slideShows = _cacheManager.GetCollection <Domain.Entities.GlobalSetting.ContactInformation>(key);

            if (slideShows == null)
            {
                slideShows = _contactInfoRepository.FindBy(x => x.Status == (enable ? (int)Status.Enable : (int)Status.Disable), true);
                _cacheManager.Put(key, slideShows);
            }

            return(slideShows);
        }