Exemplo n.º 1
0
 public ApiResponse QueryProcess(ProcessQueryFilter filter)
 {
     var result = tiKuService.GetProcessByCondition(filter);
     return ApiOk(result);
 }
Exemplo n.º 2
0
        public QueryResult<ProcessExtendModel> GetProcessByCondition(ProcessQueryFilter filter)
        {
            if (filter == null)
            {
                throw new ArgumentNullException("filter");
            }
            var queryResult = new QueryResult<ProcessExtendModel>()
            {
                Page = new PageInfo()
                {
                    PageIndex = filter.PageInfo.PageIndex <= 0 ? 1 : filter.PageInfo.PageIndex,
                    PageSize = filter.PageInfo.PageSize
                }
            };

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