123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using CB.Cache;
- using CB.Entity;
- namespace CB.Data
- {
- public partial class Caches
- {
- /// <summary>
- /// 获取模板列表
- /// </summary>
- /// <returns></returns>
- public static IList<TemplateInfo> GetTemplateList()
- {
- var cache = CBCache.GetCacheService();
- IList<TemplateInfo> list = cache.GetObject(CacheKeys.TemplateList) as IList<TemplateInfo>;
- if (null == list)
- {
- list = TemplateService.ToList();
- cache.AddObject(CacheKeys.TemplateList, list);
- }
- return list;
- }
- /// <summary>
- /// 获取模板详情
- /// </summary>
- /// <param name="tid"></param>
- /// <returns></returns>
- public static TemplateInfo GetTemplateInfo(int tid)
- {
- var list = GetTemplateList();
- if (null == list || 0 >= list.Count)
- return null;
- return list.FirstOrDefault(item => tid == item.Id);
- }
- }
- }
|