Exemplo n.º 1
0
        public async Task <PagedResult <IsolationPointDto> > GetIsolationPointsAsync(IsolationPointFilter isolationPointFilter)
        {
            var isolationPointsPagedResult = await isolationPointRepository.GetIsolationPointsAsync(isolationPointFilter);

            var isolationPointsModelPagedResult = new PagedResult <IsolationPointDto>();

            Mapper.Map(isolationPointsPagedResult, isolationPointsModelPagedResult);
            return(isolationPointsModelPagedResult);
        }
        public async Task <PagedResult <IsolationPoint> > GetIsolationPointsAsync(IsolationPointFilter filter)
        {
            filter = filter ?? new IsolationPointFilter();

            var result = unitOfWork.Query(GetIsolationPointExpression(filter), filter.PropertiesToInclude);

            List <IsolationPoint> list = await result.OrderBy(filter.OrderBy)
                                         .Skip((filter.Page - 1) * filter.Skip).Take(filter.Take)
                                         .ToListAsync();

            var pagedResult = new PagedResult <IsolationPoint>
            {
                Data     = list,
                PageInfo = await GetPageInfo(x => x.Id, filter, GetIsolationPointExpression(filter))
            };

            return(pagedResult);
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> GetIsolationPoints(IsolationPointFilter filter)
        {
            var isolationPoints = await isolationPointManager.GetIsolationPointsAsync(filter);

            return(Ok(isolationPoints));
        }
        private Expression <Func <IsolationPoint, bool> > GetIsolationPointExpression(IsolationPointFilter filter)
        {
            Expression <Func <IsolationPoint, bool> > expression = null;

            if (filter.Id > 0)
            {
                expression = x => x.Id == filter.Id;
            }
            return(expression);
        }