fix issue with client api for issue #191
This commit is contained in:
parent
e777a68105
commit
c84e374274
@ -728,21 +728,19 @@ namespace SharedLibraryCore.Services
|
|||||||
var result = new ResourceQueryHelperResult<FindClientResult>();
|
var result = new ResourceQueryHelperResult<FindClientResult>();
|
||||||
await using var context = _contextFactory.CreateContext(enableTracking: false);
|
await using var context = _contextFactory.CreateContext(enableTracking: false);
|
||||||
|
|
||||||
IQueryable<EFClient> iqClients = null;
|
IQueryable<Data.Models.Client.EFClient> iqClients = null;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(query.Xuid))
|
if (!string.IsNullOrEmpty(query.Xuid))
|
||||||
{
|
{
|
||||||
long networkId = query.Xuid.ConvertGuidToLong(System.Globalization.NumberStyles.HexNumber);
|
var networkId = query.Xuid.ConvertGuidToLong(System.Globalization.NumberStyles.HexNumber);
|
||||||
iqClients = context.Clients.
|
iqClients = context.Clients.Where(_client => _client.NetworkId == networkId);
|
||||||
Where(_client => _client.NetworkId == networkId)
|
|
||||||
.Select(client => client.ToPartialClient());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!string.IsNullOrEmpty(query.Name))
|
else if (!string.IsNullOrEmpty(query.Name))
|
||||||
{
|
{
|
||||||
iqClients = context.Clients
|
iqClients = context.Clients
|
||||||
.Where(_client => EF.Functions.Like(_client.CurrentAlias.Name.ToLower(), $"%{query.Name.ToLower()}%"))
|
.Where(_client =>
|
||||||
.Select(client => client.ToPartialClient());
|
EF.Functions.Like(_client.CurrentAlias.Name.ToLower(), $"%{query.Name.ToLower()}%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.Direction == SortDirection.Ascending)
|
if (query.Direction == SortDirection.Ascending)
|
||||||
|
Loading…
Reference in New Issue
Block a user