Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

GetNotificationsHandler.cs 950B

12345678910111213141516171819202122232425
  1. using AutoMapper;
  2. using Diligent.WebAPI.Business.Interfaces;
  3. using Diligent.WebAPI.Host.DTOs.Notification;
  4. using Diligent.WebAPI.Host.Mediator.Notifications.Queries;
  5. using MediatR;
  6. namespace Diligent.WebAPI.Host.Mediator.Notifications.Handlers
  7. {
  8. public class GetNotificationsHandler : IRequestHandler<GetNotificationsQuery, List<NotificationReadDTO>>
  9. {
  10. private readonly ICustomerRepository _customerRepository;
  11. private readonly IMapper _mapper;
  12. public GetNotificationsHandler(ICustomerRepository customerRepository, IMapper mapper)
  13. {
  14. _customerRepository = customerRepository;
  15. _mapper = mapper;
  16. }
  17. public async Task<List<NotificationReadDTO>> Handle(GetNotificationsQuery request, CancellationToken cancellationToken)
  18. {
  19. return _mapper.Map<List<NotificationReadDTO>>(await _customerRepository.ReadNotifications(request.UserId));
  20. }
  21. }
  22. }