コード例 #1
0
        public PageResultDTO <AbstractJobIndexDTOWithActions> GetAllJobIndexCategoriesWithPagination(int pageSize, int pageIndex, QueryStringConditions queryStringConditions)
        {
            var fs     = new ListFetchStrategy <JobIndexCategory>(Enums.FetchInUnitOfWorkOption.NoTracking);
            var sortBy = QueryConditionHelper.GetSortByDictionary(queryStringConditions.SortBy);

            foreach (var item in sortBy)
            {
                fs.SortCriterias.Add(new StringSortCriteria <JobIndexCategory>(item.Key,
                                                                               (item.Value.ToUpper() == "ASC")
                                                                                 ? Enums.SortOrder.Ascending
                                                                               : Enums.SortOrder.Descending));
            }
            fs.OrderBy(x => x.Id);
            fs.WithPaging(pageSize, pageIndex);
            jobIndexRep.GetAllJobIndexCategory(fs);
            var res = new PageResultDTO <AbstractJobIndexDTOWithActions>();

            res.InjectFrom(fs.PageCriteria.PageResult);
            res.Result = fs.PageCriteria.PageResult.Result.Select(r => jobIndexWithActionsMapper.MapToModel(r)).ToList();
            return(res);
        }