เพิ่ม paging noti
This commit is contained in:
parent
c6619f1253
commit
73ece9ee40
3 changed files with 20 additions and 12 deletions
|
|
@ -37,7 +37,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<List<NotificationResponse>> GetMyNotificationAsync()
|
||||
public async Task<dynamic> GetMyNotificationAsync(int page = 1, int pageSize = 25)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -50,7 +50,7 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
// throw new Exception(GlobalMessages.DataNotFound);
|
||||
}
|
||||
|
||||
var data = await _dbContext.Set<Notification>()
|
||||
var data_search = await _dbContext.Set<Notification>()
|
||||
.Where(x => x.ReceiverUserId == profile.Id)
|
||||
.Where(x => x.IsOpen == false)
|
||||
.OrderByDescending(x => x.ReceiveDate)
|
||||
|
|
@ -65,10 +65,14 @@ namespace BMA.EHR.Application.Repositories.MessageQueue
|
|||
OpenDate = x.OpenDate,
|
||||
Payload = x.Payload == "" ? null : JsonConvert.DeserializeObject<CommandPayload>(Regex.Unescape(x.Payload))
|
||||
})
|
||||
.Take(20)
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
var data = data_search
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
var _data = new { data, total = data_search.Count() };
|
||||
return _data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue