public static List <NewsEntity> GetCountNews(int count, bool isApi) { List <NewsEntity> lstNews = new List <NewsEntity>(); NewsRepository mr = new NewsRepository(); List <NewsInfo> lstInfo = Cache.Get <List <NewsInfo> >("GetCountNews" + count.ToString()); if (lstInfo.IsEmpty()) { lstInfo = mr.GetCountNews(count); Cache.Add("GetCountNews" + count.ToString(), lstInfo); } if (lstInfo != null && lstInfo.Count > 0) { foreach (NewsInfo info in lstInfo) { lstNews.Add(TranslateNewsEntity(info, isApi)); } } return(lstNews); }