diff --git a/BTCPayServer/Extensions/ControllerBaseExtensions.cs b/BTCPayServer/Extensions/ControllerBaseExtensions.cs index 73bc7599f..ca11a30c6 100644 --- a/BTCPayServer/Extensions/ControllerBaseExtensions.cs +++ b/BTCPayServer/Extensions/ControllerBaseExtensions.cs @@ -50,11 +50,12 @@ namespace BTCPayServer { model.SearchTerm = section.SearchTerm; model.TimezoneOffset = section.TimezoneOffset ?? 0; + model.Count = section.Count ?? BasePagingViewModel.CountDefault; } } else { - prop.SetValue(prefCookie, new ListQueryDataHolder(model.SearchTerm, model.TimezoneOffset)); + prop.SetValue(prefCookie, new ListQueryDataHolder(model.SearchTerm, model.TimezoneOffset, model.Count)); ctrl.Response.Cookies.Append(nameof(UserPrefsCookie), JsonConvert.SerializeObject(prefCookie)); } diff --git a/BTCPayServer/Extensions/UserPrefsCookie.cs b/BTCPayServer/Extensions/UserPrefsCookie.cs index aaf227d06..465d2896f 100644 --- a/BTCPayServer/Extensions/UserPrefsCookie.cs +++ b/BTCPayServer/Extensions/UserPrefsCookie.cs @@ -14,13 +14,15 @@ namespace BTCPayServer { public ListQueryDataHolder() { } - public ListQueryDataHolder(string searchTerm, int? timezoneOffset) + public ListQueryDataHolder(string searchTerm, int? timezoneOffset, int? count) { SearchTerm = searchTerm; TimezoneOffset = timezoneOffset; + Count = count; } public int? TimezoneOffset { get; set; } public string SearchTerm { get; set; } + public int? Count { get; set; } } } diff --git a/BTCPayServer/Models/BasePagingViewModel.cs b/BTCPayServer/Models/BasePagingViewModel.cs index 070360af5..356f1f316 100644 --- a/BTCPayServer/Models/BasePagingViewModel.cs +++ b/BTCPayServer/Models/BasePagingViewModel.cs @@ -5,8 +5,10 @@ namespace BTCPayServer.Models { public abstract class BasePagingViewModel { + public const int CountDefault = 50; + public int Skip { get; set; } = 0; - public int Count { get; set; } = 50; + public int Count { get; set; } = CountDefault; public int? Total { get; set; } [DisplayFormat(ConvertEmptyStringToNull = false)] public string SearchTerm { get; set; }