Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

RequestRepository.cs 912B

12345678910111213141516171819202122232425262728
  1. using Diligent.WebAPI.Business.Interfaces;
  2. using Diligent.WebAPI.Data;
  3. using Diligent.WebAPI.Data.Entities;
  4. using MongoDB.Driver;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace Diligent.WebAPI.Business.Services
  11. {
  12. public class RequestRepository : BaseRepository<Request>, IRequestRepository
  13. {
  14. protected new IMongoCollection<Request> _dbCollection;
  15. public RequestRepository(IMongoDBContext context) : base(context)
  16. {
  17. _dbCollection = _mongoContext.GetCollection<Request>(typeof(Request).Name);
  18. }
  19. public async Task<Request> FindRequestAsync(string customerId, string roomId)
  20. {
  21. var requests = await _dbCollection.FindAsync(x => x.SenderId == customerId && x.RoomId == roomId);
  22. return await requests.FirstOrDefaultAsync();
  23. }
  24. }
  25. }