public static void AddPagination(this HttpResponse response,
                                         int currentPage,
                                         int itemsPerPage,
                                         int totalItems,
                                         int totalPages)
        {
            var paginationHeader  = new PaginationHeader(currentPage, itemsPerPage, totalItems, totalPages);
            var camelCaseFormater = new JsonSerializerSettings();

            camelCaseFormater.ContractResolver = new CamelCasePropertyNamesContractResolver();
            response.Headers.Add("Pagination", JsonConvert.SerializeObject(paginationHeader, camelCaseFormater));
            response.Headers.Add("Access-Control-Expose-Headers", "Pagination");
        }
        public static void AddPaginationHeaders(this HttpResponse response, int currentPage, int itemsPerPage, int totalItems, int totalPages)
        {
            var paginationHeader = new PaginationHeader(currentPage, itemsPerPage, totalItems, totalPages);

            // return object names as camel cased
            var camelCaseFormatter = new JsonSerializerSettings();

            camelCaseFormatter.ContractResolver = new CamelCasePropertyNamesContractResolver();

            response.Headers.Add("Pagination", JsonConvert.SerializeObject(paginationHeader, camelCaseFormatter)); // returns Json string

            //we'll add the CORS header so that the angular application doesn't compliain about it because it doesn't have the appropriate access control allow origin.
            response.Headers.Add("Access-Control-Expose-Headers", "Pagination");
        }
        public static void AddPagination(
            this HttpResponse response, int currentPage,
            int itemsPerPage, int totalItems, int totalPages)
        {
            var paginatinoHeader = new PaginationHeader(currentPage,
                                                        itemsPerPage, totalItems, totalPages);

            // Serialize the pagination header in JSON format in Camel Case.
            var camelCaseFormatter = new JsonSerializerSettings();

            camelCaseFormatter.ContractResolver = new CamelCasePropertyNamesContractResolver();
            response.Headers.Add("Pagination", JsonConvert.SerializeObject(
                                     paginatinoHeader, camelCaseFormatter));

            // The "Pagination" header is not exposed to client by default
            response.Headers.Add("Access-Control-Expose-Headers", "Pagination");
        }