Ejemplo n.º 1
0
        public HttpResponseMessage GetListPaging(HttpRequestMessage request, int pageIndex, int pageSize,
                                                 int?computerTypeId, int?deparmentTypeId, int?producerTypeId, string filter = "")
        {
            return(CreateHttpResponse(request, () =>
            {
                int totalRow;

                var model = _computerService.GetAllPagingWithMultiFilters(pageIndex, pageSize, out totalRow, computerTypeId, deparmentTypeId, producerTypeId, filter);
                var modelVm = Mapper.Map <List <Model.Models.Computer>, List <ComputerDetailViewModel> >(model);

                var pagedSet = new PaginationSet <ComputerDetailViewModel>()
                {
                    PageIndex = pageIndex,
                    PageSize = pageSize,
                    TotalRows = totalRow,
                    Items = modelVm,
                };

                var response = request.CreateResponse(HttpStatusCode.OK, pagedSet);

                return response;
            }));
        }