phonebook_server/phonebook_server/Extensions/HttpExtensions.cs
/// <summary>
///     Add the pagination information in http response header
/// </summary>
Add the pagination information in http response header
Add the pagination information in http response header
public static void AddPaginationHeader(this HttpResponse response, int currentPage, int itemsPerPage,
            int totalItems, int totalPages)
        {
            var paginationHeaders = new PaginationHeader(currentPage, itemsPerPage, totalItems, totalPages);
            var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
            response.Headers.Add("Pagination", JsonSerializer.Serialize(paginationHeaders, options));
            response.Headers.Add("Access-Control-Expose-Headers", "Pagination");
        }
public static void AddPaginationHeader ( this HttpResponse response , int currentPage , int itemsPerPage , int totalItems , int totalPages ) { var paginationHeaders = new PaginationHeader ( currentPage , itemsPerPage , totalItems , totalPages ) ; var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy . CamelCase } ; response . Headers . Add ( " " , JsonSerializer . Serialize ( paginationHeaders , options ) ) ; response . Headers . Add ( " " , " " ) ; }
Add the pagination information in http response header
Add the pagination information in http response header
HttpResponse
this
currentPage
int
itemsPerPage
int
totalItems
int
totalPages
int