Skip to content

Commit

Permalink
Use List<T> in search result
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-dudarev committed Aug 10, 2023
1 parent a3841ab commit 253ad0a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/VirtoCommerce.Platform.Data/GenericCrud/SearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ public virtual async Task<TResult> SearchAsync(TCriteria criteria, bool clone =
var result = AbstractTypeFactory<TResult>.TryCreateInstance();
result.TotalCount = idsResult.TotalCount;

result.Results = idsResult.Results.Any()
? (await _crudService.GetAsync(idsResult.Results, criteria.ResponseGroup, clone))
.OrderBy(x => idsResult.Results.IndexOf(x.Id))
.ToList()
: Array.Empty<TModel>();
if (idsResult.Results.Any())
{
var models = await _crudService.GetAsync(idsResult.Results, criteria.ResponseGroup, clone);
result.Results.AddRange(models.OrderBy(x => idsResult.Results.IndexOf(x.Id)));
}

return await ProcessSearchResultAsync(result, criteria);
}
Expand Down

0 comments on commit 253ad0a

Please sign in to comment.