using CZFW.Framework.Interface; using CZFW.Framework.Model.Entity; using System.Collections.Generic; using System.ComponentModel; using System.Linq; namespace CZFW.Framework.Logic { public class GalleryLogic : LogicBase<GalleryEntity>, IGallery { /// <summary> /// 根据类型列表获取广告位 /// </summary> /// <param name="typeList">类型列表</param> /// <returns></returns> public IList<GalleryEntity> GetGalleryList(IList<int> typeIdList) { return GetEntities(x => typeIdList.Contains(x.TypeId), x => x.SortOrder, ListSortDirection.Descending).ToList(); } /// <summary> /// 根据类型获取广告位列表 /// </summary> /// <param name="typeId">类型</param> /// <returns></returns> public IList<GalleryEntity> GetGalleryList(int typeId) { return GetEntities(x => x.TypeId == typeId, x => x.SortOrder, ListSortDirection.Descending).ToList(); } /// <summary> /// 根据类型获取广告位 /// </summary> /// <param name="typeId">类型</param> /// <returns></returns> public GalleryEntity GetGallery(int typeId) { return GetEntity(x => x.TypeId == typeId); } public IList<GalleryEntity> GetList(int typeId, int pageIndex, int pageSize, out int rowsCount) { var queryable = Queryable.Where(x => x.TypeId == typeId); rowsCount = queryable.Count(); var list = queryable.OrderByDescending(x =>x.SortOrder).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); return list; } } }