using BMA.EHR.Application.Common.Interfaces; using BMA.EHR.Domain.Models.MetaData; using BMA.EHR.Domain.Models.Notifications; using BMA.EHR.Domain.Models.Placement; using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BMA.EHR.Application.Repositories.MessageQueue { public class MessageQueueRepository : GenericRepository { #region " Fields " private readonly IApplicationDBContext _dbContext; private readonly IHttpContextAccessor _httpContextAccessor; #endregion #region " Constructor and Destuctor " public MessageQueueRepository(IApplicationDBContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor) { _dbContext = dbContext; _httpContextAccessor = httpContextAccessor; } #endregion #region " Methods " public async Task> GetUnSentAsync(int count = 10) { var data = await _dbContext.Set().Where(x => !x.IsSend) .AsNoTracking() .OrderBy(m => m.CreatedAt) .Take(count) .ToListAsync(); return data; } #endregion } }