Exemplo n.º 1
0
        public async Task <PagedResult <WorkCertificate> > GetWorkCertificatesAsync(WorkCertificateFilter filter)
        {
            filter = filter ?? new WorkCertificateFilter();

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

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

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

            return(pagedResult);
        }
Exemplo n.º 2
0
        private Expression <Func <WorkCertificate, bool> > GetWorkCertificateExpression(WorkCertificateFilter filter)
        {
            Expression <Func <WorkCertificate, bool> > expression = null;

            if (filter.Id > 0)
            {
                expression = x => x.Id == filter.Id;
            }
            return(expression);
        }
        public async Task <PagedResult <WorkCertificateDto> > GetWorkCertificatesAsync(WorkCertificateFilter workCertificateFilter)
        {
            var workCertificatesPagedResult = await workCertificateRepository.GetWorkCertificatesAsync(workCertificateFilter);

            var workCertificatesModelPagedResult = new PagedResult <WorkCertificateDto>();

            Mapper.Map(workCertificatesPagedResult, workCertificatesModelPagedResult);
            return(workCertificatesModelPagedResult);
        }
        public async Task <IHttpActionResult> GetWorkCertificates(WorkCertificateFilter filter)
        {
            var workCerfificates = await workCerfificateManager.GetWorkCertificatesAsync(filter);

            return(Ok(workCerfificates));
        }