public void PublishCommentLikesUpdate(CommentLikesUpdate commentLikesUpdate) { using (var svc = new ServiceProxyHelper<INotificationService>("NotificationService")) { svc.Proxy.PublishCommentLikesUpdate(commentLikesUpdate); } }
public ActionResult SendMessage(NotificationModel model) { if (!ModelState.IsValid) { return Json(ModelState, JsonRequestBehavior.AllowGet); } switch (model.Type) { case "CommentAdded": { var data = new CommentAdded { ClientFunction = Constants.SocketClientFunctions.CommentAdded.ToString(), PostId = model.ChannelId ?? 1, Comment = new Comment { Id = 99, PostId = model.ChannelId ?? 1, CommentMessage = "Foo bar" } }; _notificationResource.PublishCommentAdded(data); } break; case "CommentLikesUpdate": { var data = new CommentLikesUpdate { ClientFunction = Constants.SocketClientFunctions.CommentLikesUpdate.ToString(), CommentId = 1, PostId = model.ChannelId ?? 1, CommentLikes = new List<CommentLike> { new CommentLike { CommentId = 1, UserId = 1}, new CommentLike { CommentId = 1, UserId = 2}, } }; _notificationResource.PublishCommentLikesUpdate(data); } break; case "PostLikesUpdate": { var data = new PostLikesUpdate { ClientFunction = Constants.SocketClientFunctions.PostLikesUpdate.ToString(), PostId = model.ChannelId ?? 1, PostLikes = new List<PostLike> { new PostLike { PostId = model.ChannelId ?? 1, UserId = 1}, new PostLike { PostId = model.ChannelId ?? 1, UserId = 2}, } }; _notificationResource.PublishPostLikesUpdate(data); } break; default: _notificationResource.PublishMessage(model.Message); break; } return Json(new { Message = "Success" }, JsonRequestBehavior.AllowGet); }
public void CommentsLikeUpdate(CommentLikesUpdate commentLikesUpdate) { try { _httpClientHelper.Post(_configurationHelper.GetAppSettings("BlogRoot"), "hub/commentLikesUpdate?format=json", commentLikesUpdate); } catch (Exception ex) { _errorSignaler.SignalFromCurrentContext(ex); } }
public void Add(CommentLike commentLike) { var result = _commentLikesLogic.Add(commentLike); if (result != null && result.Error != null) throw new Exception(result.Error.Message); var parentComment = _commentsLogic.Get(commentLike.CommentId); if (parentComment == null) throw new Exception(string.Format( "Failed to like comment {0} due to error in fetching comment", commentLike.CommentId)); var commentLikes = _commentLikesLogic.Get(commentLike.CommentId); if (commentLikes == null) throw new Exception(string.Format( "Failed to like comment {0} due to error in fetching likes in comment", commentLike.CommentId)); var commentLikesUpdate = new CommentLikesUpdate { CommentId = commentLike.CommentId, PostId = parentComment.PostId, CommentLikes = commentLikes, ClientFunction = Constants.SocketClientFunctions.CommentLikesUpdate.ToString() }; _redisService.Publish(commentLikesUpdate); }
public void PublishCommentLikesUpdate(CommentLikesUpdate commentLikesUpdate) { _redisService.Publish(commentLikesUpdate); }
public void PublishCommentLikesUpdate(CommentLikesUpdate commentLikesUpdate) { throw new System.NotImplementedException(); }