using Diligent.WebAPI.Business.Interfaces; using Diligent.WebAPI.Data; using Diligent.WebAPI.Data.Entities; using MongoDB.Driver; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Diligent.WebAPI.Business.Services { public class RequestRepository : BaseRepository, IRequestRepository { protected new IMongoCollection _dbCollection; public RequestRepository(IMongoDBContext context) : base(context) { _dbCollection = _mongoContext.GetCollection(typeof(Request).Name); } public async Task FindRequestAsync(string customerId, string roomId) { var requests = await _dbCollection.FindAsync(x => x.SenderId == customerId && x.RoomId == roomId); return await requests.FirstOrDefaultAsync(); } } }