optimize the find client query

This commit is contained in:
RaidMax
2019-04-25 21:05:35 -05:00
parent 02622ea7de
commit 599a14b646
5 changed files with 58 additions and 35 deletions

View File

@ -121,18 +121,7 @@ namespace WebfrontCore.Controllers
public async Task<IActionResult> FindAsync(string clientName)
{
var clients = (await Manager.GetClientService().FindClientsByIdentifier(clientName))
.OrderByDescending(c => c.LastConnection);
var clientsDto = clients.Select(c => new PlayerInfo()
{
Name = c.Name,
Level = c.Level.ToLocalizedLevelName(),
LevelInt = (int)c.Level,
LastConnection = c.LastConnection,
ClientId = c.ClientId
})
.ToList();
var clientsDto = await Manager.GetClientService().FindClientsByIdentifier(clientName);
ViewBag.Title = $"{clientsDto.Count} {Localization["WEBFRONT_CLIENT_SEARCH_MATCHING"]} \"{clientName}\"";
return View("Find/Index", clientsDto);