diff --git a/src/Web/AdminPanel/Pages/Accounts.razor b/src/Web/AdminPanel/Pages/Accounts.razor
index 1b1d677..81ab10a 100644
--- a/src/Web/AdminPanel/Pages/Accounts.razor
+++ b/src/Web/AdminPanel/Pages/Accounts.razor
@@ -1,4 +1,4 @@
-@page "/accounts"
+@page "/accounts"
@using MUnique.OpenMU.DataModel
@using MUnique.OpenMU.DataModel.Entities;
@using MUnique.OpenMU.Persistence;
@@ -21,6 +21,15 @@
@typeof(Account).GetPropertyCaption(nameof(Account.EMail)) |
@Resources.Action |
+
+
+
+
+
+
+ |
+ |
+
@item.LoginName |
@item.State.GetEnumCaption() |
diff --git a/src/Web/Shared/Services/AccountService.cs b/src/Web/Shared/Services/AccountService.cs
index e54f372..a4e5be9 100644
--- a/src/Web/Shared/Services/AccountService.cs
+++ b/src/Web/Shared/Services/AccountService.cs
@@ -1,4 +1,4 @@
-//
+//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
@@ -31,6 +31,25 @@ public class AccountService : IDataService, ISupportDataChangedNotifica
this._modalService = modalService;
}
+ private string _searchFilter = string.Empty;
+
+ ///
+ /// Gets or sets the search filter query.
+ ///
+ public string SearchFilter
+ {
+ get => this._searchFilter;
+ set
+ {
+ var newValue = value ?? string.Empty;
+ if (this._searchFilter != newValue)
+ {
+ this._searchFilter = newValue;
+ this.RaiseDataChanged();
+ }
+ }
+ }
+
///
public event EventHandler? DataChanged;
@@ -45,7 +64,24 @@ public class AccountService : IDataService, ISupportDataChangedNotifica
try
{
var playerContext = (IPlayerContext)await this._dataSource.GetContextAsync().ConfigureAwait(false);
- return (await playerContext.GetAccountsOrderedByLoginNameAsync(offset, count).ConfigureAwait(false)).ToList();
+ var filter = this.SearchFilter.Trim();
+ if (string.IsNullOrWhiteSpace(filter))
+ {
+ return (await playerContext.GetAccountsOrderedByLoginNameAsync(offset, count).ConfigureAwait(false)).ToList();
+ }
+
+ var allAccounts = await playerContext.GetAsync().ConfigureAwait(false);
+ var results = allAccounts.Where(account =>
+ (account.LoginName != null && account.LoginName.Contains(filter, StringComparison.InvariantCultureIgnoreCase))
+ || account.Characters.Any(c => c.Name != null && c.Name.Contains(filter, StringComparison.InvariantCultureIgnoreCase))
+ ).ToList();
+
+ if (offset >= results.Count)
+ {
+ return results.Take(count).ToList();
+ }
+
+ return results.Skip(offset).Take(count).ToList();
}
catch
{