diff --git a/BTCPayServer/Models/BasePagingViewModel.cs b/BTCPayServer/Models/BasePagingViewModel.cs new file mode 100644 index 000000000..4d69368d6 --- /dev/null +++ b/BTCPayServer/Models/BasePagingViewModel.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BTCPayServer.Models +{ + public class BasePagingViewModel + { + public int Skip { get; set; } + public int Count { get; set; } + public int Total { get; set; } + public string SearchTerm { get; set; } + public int? TimezoneOffset { get; set; } + } +} diff --git a/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs b/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs index ca0404d3f..ef2d03fd2 100644 --- a/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs +++ b/BTCPayServer/Models/InvoicingModels/InvoicesModel.cs @@ -4,13 +4,8 @@ using BTCPayServer.Services.Invoices; namespace BTCPayServer.Models.InvoicingModels { - public class InvoicesModel + public class InvoicesModel : BasePagingViewModel { - public int Skip { get; set; } - public int Count { get; set; } - public int Total { get; set; } - public string SearchTerm { get; set; } - public int? TimezoneOffset { get; set; } public List Invoices { get; set; } = new List(); public string[] StoreIds { get; set; } } diff --git a/BTCPayServer/Models/PaymentRequestViewModels/ListPaymentRequestsViewModel.cs b/BTCPayServer/Models/PaymentRequestViewModels/ListPaymentRequestsViewModel.cs index 8f9cedc70..a45521817 100644 --- a/BTCPayServer/Models/PaymentRequestViewModels/ListPaymentRequestsViewModel.cs +++ b/BTCPayServer/Models/PaymentRequestViewModels/ListPaymentRequestsViewModel.cs @@ -8,13 +8,8 @@ using PaymentRequestData = BTCPayServer.Data.PaymentRequestData; namespace BTCPayServer.Models.PaymentRequestViewModels { - public class ListPaymentRequestsViewModel + public class ListPaymentRequestsViewModel : BasePagingViewModel { - public int Skip { get; set; } - public int Count { get; set; } - public int Total { get; set; } - public string SearchTerm { get; set; } - public int? TimezoneOffset { get; set; } public List Items { get; set; } } diff --git a/BTCPayServer/Views/Invoice/ListInvoices.cshtml b/BTCPayServer/Views/Invoice/ListInvoices.cshtml index c834944de..74314391e 100644 --- a/BTCPayServer/Views/Invoice/ListInvoices.cshtml +++ b/BTCPayServer/Views/Invoice/ListInvoices.cshtml @@ -313,79 +313,14 @@ } - - @{ - string ListInvoicesPage(int prevNext, int count) - { - var skip = Model.Skip; - if (prevNext == -1) - { - skip = Math.Max(0, Model.Skip - Model.Count); - } - else if (prevNext == 1) - { - skip = Model.Skip + count; - } - - var act = Url.Action("ListInvoices", new - { - searchTerm = Model.SearchTerm, - skip = skip, - count = count, - }); - - return act; - } - } +