Пример #1
0
        public async Task Handle(NotificationInfo notificationInfo)
        {
            var notification = JsonSerializer.Deserialize <NotificationContent>(notificationInfo.Content);

            await(notificationInfo.Type switch
            {
                NotificationType.Broadcast => _notificationSender.SendBroadcast(notification.Message),
                NotificationType.Direct => _notificationSender.SendDirect(notification.From, notification.To, notification.Message),
                _ => throw new ArgumentException(),
            });