示例#1
0
        public IResult <IQueryable <ISampleOrderSummaryReturn> > GetSampleOrders(FilterSampleOrdersParameters parameters)
        {
            var parsedFilterParameters = parameters.ParseToPredicateBuilderFilters();

            if (!parsedFilterParameters.Success)
            {
                return(parsedFilterParameters.ConvertTo <IQueryable <ISampleOrderSummaryReturn> >());
            }

            var predicateResult = SampleOrderPredicateBuilder.BuildPredicate(parsedFilterParameters.ResultingObject);

            if (!predicateResult.Success)
            {
                return(predicateResult.ConvertTo <IQueryable <ISampleOrderSummaryReturn> >());
            }
            var predicate = predicateResult.ResultingObject;

            var select = SampleOrderProjectors.SelectSummary();
            var query  = _sampleOrderUnitOfWork.SampleOrderRepository.All().AsExpandable().Where(predicate).Select(select);

            return(new SuccessResult <IQueryable <ISampleOrderSummaryReturn> >(query));
        }