private async Task <JsonResult> NotifyClientsAndGenerateVoteResultAsync(long commentId, int currentUserAccountId) { CommentAggregate commentAggregate = await _commentRepository.GetAggregateAsync(commentId, currentUserAccountId); await _notificationService.ClearCommentVoteNotificationsAsync(commentId, commentAggregate.CreatedByAccountId, currentUserAccountId); if (commentAggregate.CurrentUserVote != 0) { var notificationChange = new NotificationChange { CreatedByAccountId = currentUserAccountId, CreatedOn = _systemClock.UtcNow, NotificationActionType = commentAggregate.CurrentUserVote > 0 ? NotificationActionType.Upvoted : NotificationActionType.Downvoted }; await _notificationService.NotifyCommentOwnerAsync(commentId, notificationChange); } _notificationService.UpdateClientsAfterVote(commentAggregate); var model = new CommentVoteViewModel { CommentId = commentId, VoteScore = commentAggregate.VoteScore, CurrentUserVote = commentAggregate.CurrentUserVote }; return(Json(model, JsonRequestBehavior.AllowGet)); }
public void UpdateClientsAfterVote(CommentAggregate commentAggregate) { throw new System.NotImplementedException(); }
public void BroadcastCountdownUpdate(CommentAggregate commentAggregate) => Hub.Clients.All.broadcastCommentUpdate(commentAggregate);
public static CommentViewModel ToCommentViewModel(this CommentAggregate commentAggregate) { return(Mapper.Map <CommentAggregate, CommentViewModel>(commentAggregate)); }
public void UpdateClientsAfterVote(CommentAggregate commentAggregate) => _notificationHub.BroadcastCountdownUpdate(commentAggregate);