Esempio n. 1
0
        public StaticContent GetStaticContent(int menuId, bool isCache = true)
        {
            StaticContent staticContent;

            if (isCache)
            {
                var sbKey = new StringBuilder();
                sbKey.AppendFormat(CacheKey, "GetStaticContent");
                sbKey.Append(menuId);

                var key = sbKey.ToString();

                staticContent = _cacheManager.Get <StaticContent>(key);
                if (staticContent == null)
                {
                    staticContent = _staticContentRepository.Get(x => x.MenuId == menuId, true);
                    _cacheManager.Put(key, staticContent);
                }
            }
            else
            {
                staticContent = _staticContentRepository.Get(x => x.MenuId == menuId, true);
            }

            return(staticContent);
        }