1
0
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:
RaidMax
2019-07-16 15:27:19 -05:00
parent d4598d6687
commit 1705db63ff
13 changed files with 137 additions and 6474 deletions

View File

@ -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
}
}