Exemplo n.º 1
0
        //GetListForCategory
        public IEnumerable <IdTitle> GetListForCategory(long eventID)
        {
            DataCacheObject dco = new DataCacheObject(DataCacheType.REFERENCE, DataCacheRegions.CATEGORIES, "GETLISTFORCATEGORY",
                                                      new object[] { eventID }, CachingExpirationTime.Hours_01);
            List <IdTitle> result = CacheRepository.Get(dco) as List <IdTitle>;

            if (result != null && result.Any())
            {
                return(result.AsEnumerable());
            }
            result = (from p in dataContext.spCategory_View_MainAndCategories(eventID)
                      select new IdTitle
            {
                ID = p.EventCategory_ID,
                Title = String.Format("{0} > {1}", p.MainCategoryTitle, p.CategoryTitle)
            }).ToList();
            if (result.Any())
            {
                dco.Data = result;
                CacheRepository.Add(dco);
            }
            return(result.AsEnumerable());
        }