forked from ddrilling/AsbCloudServer
Merge branch 'fix/pagination-container-items' into dev
This commit is contained in:
commit
1d94a64e49
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
@ -13,16 +14,7 @@ namespace AsbCloudApp.Data
|
||||
/// </summary>
|
||||
public PaginationContainer()
|
||||
{
|
||||
Items = new List<T>(4);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// конструктор
|
||||
/// </summary>
|
||||
/// <param name="capacity"></param>
|
||||
public PaginationContainer(int capacity)
|
||||
{
|
||||
Items = new List<T>(capacity);
|
||||
Items = Enumerable.Empty<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -43,6 +35,6 @@ namespace AsbCloudApp.Data
|
||||
/// <summary>
|
||||
/// Данные
|
||||
/// </summary>
|
||||
public List<T> Items { get; set; }
|
||||
public IEnumerable<T> Items { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
.ToListAsync(token)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
result.Items = entities.Select(e => Convert(e)).ToList();
|
||||
result.Items = entities.Select(e => Convert(e));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -70,14 +70,14 @@ public class NotificationRepository : CrudCacheRepositoryBase<NotificationDto, N
|
||||
|
||||
if (result.Count < skip)
|
||||
return result;
|
||||
|
||||
|
||||
result.Items = await query
|
||||
.SortBy(request.SortFields)
|
||||
.Skip(skip)
|
||||
.Take(take)
|
||||
.AsNoTracking()
|
||||
.Select(x => x.Adapt<NotificationDto>())
|
||||
.ToListAsync(cancellationToken);
|
||||
.ToArrayAsync(cancellationToken);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ namespace AsbCloudInfrastructure.Repository
|
||||
.Skip(result.Skip)
|
||||
.Take(result.Take);
|
||||
|
||||
result.Items = await query.ToListAsync(token);
|
||||
result.Items = await query.ToArrayAsync(token);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,8 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
||||
var eventsDict = events.ToDictionary(x=>x.IdEvent, x => x);
|
||||
var usersDict = users.ToDictionary(x => x.IdUser, x => x);
|
||||
|
||||
var messagesDtoList = new List<MessageDto>();
|
||||
|
||||
foreach (var message in messagesList)
|
||||
{
|
||||
var messageDto = new MessageDto
|
||||
@ -126,10 +128,11 @@ namespace AsbCloudInfrastructure.Services.SAUB
|
||||
messageDto.CategoryId = e.IdCategory;
|
||||
messageDto.Message = e.MakeMessageText(message);
|
||||
}
|
||||
|
||||
result.Items.Add(messageDto);
|
||||
messagesDtoList.Add(messageDto);
|
||||
}
|
||||
|
||||
result.Items = result.Items.Concat(messagesDtoList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user