private async Task CreateNotification(Vote vote, Account owner) { var notification = new Notification { AccountId = owner.Id, Read = false, CreatedOn = DateTime.UtcNow, Type = NotificationType.Vote, Content = await GenerateNotificationContentAsync(vote) }; _notificationDispatcher.Dispatch(notification); }
public void Dispatch(Notification notification) { var voteHub = new NotificationHub(); voteHub.Send(notification.AccountId, notification.Content); // INotificationFactory to generate : // INotificationHub -> {VoteNotificationHub -> CommentNotificationHub -> ReputationNotificationHub} // -> Send(accountId, content) // -> SendAllOthers( // voteHub.SendAllOthers(type[Comment || Countdown], id, value); // TODO // if email is present notify a message as well // if the notification type is for a Vote -> update the Score of the Comment or Countdown // Save to DB }
public void Create(Notification notification) { _notifications.Add(notification); }