public HttpResponseMessage GetListPaging(HttpRequestMessage request, int page, int pageSize, string filter = null) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; _appRoleService.InsertRoleFromSystem(); int totalRow = 0; var model = _appRoleService.GetAll(page, pageSize, out totalRow, filter); IEnumerable <AppRoleVm> modelVm = Mapper.Map <IEnumerable <AppRole>, IEnumerable <AppRoleVm> >(model); PaginationSet <AppRoleVm> pagedSet = new PaginationSet <AppRoleVm>() { Page = page, TotalCount = totalRow, TotalPages = (int)Math.Ceiling((decimal)totalRow / pageSize), Items = modelVm }; response = request.CreateResponse(HttpStatusCode.OK, pagedSet); return response; })); }