sledgemapper/Sledgemapper.Api/Handlers/SendDeleteNoteMessage.cs
Michele Scandura 1759f7cd8e bug fixes
2020-12-08 16:34:02 +00:00

22 lines
759 B
C#

using MediatR;
using Microsoft.AspNetCore.SignalR;
using Sledgemapper.Clients;
using System.Threading;
using System.Threading.Tasks;
using Sledgemapper.Api.Hubs;
using Sledgemapper.Api.Notifications;
namespace Sledgemapper.Api.Handlers
{
public class SendDeleteNoteMessage : INotificationHandler<DeleteNoteNotification>
{
private readonly IHubContext<SledgemapperHub, ISledgemapperClient> _hub;
public SendDeleteNoteMessage(IHubContext<SledgemapperHub, ISledgemapperClient> hub) => _hub = hub;
public async Task Handle(DeleteNoteNotification notification, CancellationToken cancellationToken)
{
await _hub.Clients.Groups(notification.Session.SessionName).DeleteNote(notification.Note);
}
}
}