mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
add most recent players dropdown option to webfront
remove unneeded compiled bootstrap file
This commit is contained in:
@ -5,6 +5,7 @@ using SharedLibraryCore.Configuration;
|
||||
using System.Reflection;
|
||||
using SharedLibraryCore.Database.Models;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
|
||||
namespace SharedLibraryCore.Interfaces
|
||||
{
|
||||
@ -36,6 +37,15 @@ namespace SharedLibraryCore.Interfaces
|
||||
IPageList GetPageList();
|
||||
IList<IRConParser> AdditionalRConParsers { get; }
|
||||
IList<IEventParser> AdditionalEventParsers { get; }
|
||||
/// <summary>
|
||||
/// provides a method to execute database operations by name without exposing the
|
||||
/// service level methods
|
||||
/// todo: this could be made obsolete by creating a seperate service library with more concrete definitions
|
||||
/// </summary>
|
||||
/// <param name="operationName"></param>
|
||||
/// <returns></returns>
|
||||
Task<IList<T>> ExecuteSharedDatabaseOperation<T>(string operationName);
|
||||
void RegisterSharedDatabaseOperation(Task<IList> operation, string operationName);
|
||||
IRConParser GenerateDynamicRConParser();
|
||||
IEventParser GenerateDynamicEventParser();
|
||||
string Version { get;}
|
||||
|
@ -109,7 +109,7 @@ namespace SharedLibraryCore.Services
|
||||
var aliasSql = iqAliases.ToSql();
|
||||
#endif
|
||||
var aliases = await iqAliases.ToListAsync();
|
||||
|
||||
|
||||
// see if they have a matching IP + Name but new NetworkId
|
||||
var existingExactAlias = aliases.FirstOrDefault(a => a.Name == name && a.IPAddress == ip);
|
||||
bool hasExactAliasMatch = existingExactAlias != null;
|
||||
@ -531,6 +531,32 @@ namespace SharedLibraryCore.Services
|
||||
.CountAsync();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// gets the 10 most recently added clients to IW4MAdmin
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<IList<PlayerInfo>> GetRecentClients()
|
||||
{
|
||||
using (var context = new DatabaseContext(true))
|
||||
{
|
||||
var iqClients = context.Clients
|
||||
.Where(_client => _client.CurrentAlias.IPAddress != null)
|
||||
.Select(_client => new PlayerInfo()
|
||||
{
|
||||
ClientId = _client.ClientId,
|
||||
Name = _client.CurrentAlias.Name,
|
||||
IPAddress = _client.CurrentAlias.IPAddress.ConvertIPtoString(),
|
||||
LastConnection = _client.LastConnection
|
||||
})
|
||||
.OrderByDescending(_client => _client.ClientId)
|
||||
.Take(10);
|
||||
#if DEBUG
|
||||
var sql = iqClients.ToSql();
|
||||
#endif
|
||||
return await iqClients.ToListAsync();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user