public HttpResponseMessage getAllPage(HttpRequestMessage request, int page, int pageSize = 20) { return(CreateHttpResponse(request, () => { int totalRow = 0; var responseData = ErrorService.ReadPage(page, pageSize); totalRow = ErrorService.GetAll().Count; var paginationSet = new PaginationSet <ErrorModel>() { Items = responseData, Page = page, TotalCount = totalRow, TotalPages = (int)Math.Ceiling((decimal)totalRow / pageSize) }; var response = request.CreateResponse(HttpStatusCode.OK, paginationSet); return response; })); }