Esempio n. 1
0
        public async Task <PagedModel <CfgDto> > GetPagedListV2(CfgSearchDto criteria)
        {
            Expression <Func <SysCfg, bool> > condition = it => true;

            if (!string.IsNullOrWhiteSpace(criteria.CfgName))
            {
                condition = condition.And(it => it.CfgName.Contains(criteria.CfgName));
            }

            if (!string.IsNullOrWhiteSpace(criteria.CfgValue))
            {
                condition = condition.And(it => it.CfgValue.Contains(criteria.CfgValue));
            }

            var result = await _unitOfWork.CfgRepository.PagedAsync(
                criteria.Page,
                criteria.Limit,
                condition,
                it => it.Id,
                true);

            var dto = CfgMapper.ToCfgDto(result);

            return(dto);
        }
Esempio n. 2
0
        public async Task <PagedModel <CfgDto> > GetPagedList(CfgSearchDto criteria)
        {
            var searchCriteria = new SearchCriteria
            {
                Keyword      = criteria.CfgName,
                SearchFields = new string[] { "CfgName" },
                Offset       = (criteria.Page - 1) * criteria.Limit,
                Count        = criteria.Limit
            };
            var result = await _cacheManager.GetOrCreatePagedListAsync <SysCfg>(searchCriteria, async options =>
            {
                return(new List <SysCfg>());
            });

            var dto = CfgMapper.ToCfgDto(new PagedModel <SysCfg>());

            return(dto);
        }