using CP.Cache;
using CP.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CP.Business
{
public class ZtPageBll
{
///
/// 缓存
///
static WMCache cache = WMCache.GetCacheService();
public static List GetList()
{
string key = string.Format(CacheKeys.Zt_Page);
List list = cache.GetObject>(key) as List;
if (list == null)
{
var dc = new DataConnect();
list = dc.db.Fetch("where id>0");
cache.AddObject(key, list, (int)CacheTime.System);
}
return list;
}
public static ZtPage GetById(int id)
{
string key = string.Format(CacheKeys.Zt_Page);
List list = GetList();
if (list == null)
return new ZtPage();
return list.SingleOrDefault(m => m.Id == id) ?? new ZtPage();
}
}
}