fix issue with client api for issue #191

This commit is contained in:
RaidMax 2021-03-27 18:54:25 -05:00
parent e777a68105
commit c84e374274

View File

@ -728,21 +728,19 @@ namespace SharedLibraryCore.Services
var result = new ResourceQueryHelperResult<FindClientResult>();
await using var context = _contextFactory.CreateContext(enableTracking: false);
IQueryable<EFClient> iqClients = null;
IQueryable<Data.Models.Client.EFClient> iqClients = null;
if (!string.IsNullOrEmpty(query.Xuid))
{
long networkId = query.Xuid.ConvertGuidToLong(System.Globalization.NumberStyles.HexNumber);
iqClients = context.Clients.
Where(_client => _client.NetworkId == networkId)
.Select(client => client.ToPartialClient());
var networkId = query.Xuid.ConvertGuidToLong(System.Globalization.NumberStyles.HexNumber);
iqClients = context.Clients.Where(_client => _client.NetworkId == networkId);
}
else if (!string.IsNullOrEmpty(query.Name))
{
iqClients = context.Clients
.Where(_client => EF.Functions.Like(_client.CurrentAlias.Name.ToLower(), $"%{query.Name.ToLower()}%"))
.Select(client => client.ToPartialClient());
.Where(_client =>
EF.Functions.Like(_client.CurrentAlias.Name.ToLower(), $"%{query.Name.ToLower()}%"));
}
if (query.Direction == SortDirection.Ascending)