Пример #1
0
 public ApiResponse GetTiKuByCondition(TiKuQueryFilter filter)
 {
     var result = tiKuService.GetTiKuByCondition(filter);
     return ApiOk(result);
 }
Пример #2
0
        public QueryResult<TiKuMasterModel> GetTiKuByCondition(TiKuQueryFilter filter)
        {
            if (filter == null)
            {
                throw new ArgumentNullException("filter");
            }

            var queryResult = new QueryResult<TiKuMasterModel>()
            {
                Page = new PageInfo()
                {
                    PageIndex = filter.PageInfo.PageIndex <= 0 ? 1 : filter.PageInfo.PageIndex,
                    PageSize = filter.PageInfo.PageSize
                }
            };

            queryResult.Page.Total = tiKuRepo.Entities.Count();
            var query = tiKuRepo.Entities.OrderByDescending(m => m.LastEditDate)
                .Skip(filter.PageInfo.PageSize * (filter.PageInfo.PageIndex - 1))
                .Take(filter.PageInfo.PageSize);
            queryResult.Result = PublicFunc.EntityMap<List<TiKuMaster>, List<TiKuMasterModel>>(query.ToList());
            return queryResult;
        }