public async Task Handle(ShopCommentAddedEvent message) // Notify the owner of the shop. { var shop = await _shopRepository.Get(message.ShopId); var notification = new NotificationAggregate { Id = Guid.NewGuid().ToString(), Content = "add_shop_comment", IsRead = false, From = message.Subject, To = shop.Subject, CreatedDateTime = DateTime.UtcNow, Parameters = new[] { new NotificationParameter { Id = Guid.NewGuid().ToString(), Type = NotificationParameterTypes.ShopId, Value = message.ShopId } } }; await _notificationRepository.Add(notification); _eventPublisher.Publish(new NotificationAddedEvent { Id = notification.Id, Content = notification.Content, IsRead = notification.IsRead, From = notification.From, To = notification.To }); }
public Task Handle(ShopCommentAddedEvent message) { if (message == null) { throw new ArgumentNullException(nameof(message)); } var notifier = _connectionManager.GetHubContext <Notifier>(); notifier.Clients.All.shopCommentAdded(_responseBuilder.GetShopCommentAddedEvent(message)); return(Task.FromResult(0)); }