public void PublishPostLikesUpdate(PostLikesUpdate postLikesUpdate) { using (var svc = new ServiceProxyHelper<INotificationService>("NotificationService")) { svc.Proxy.PublishPostLikesUpdate(postLikesUpdate); } }
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 PushPostLikes(PostLikesUpdate postLikesUpdate) { try { _httpClientHelper.Post(_configurationHelper.GetAppSettings("BlogRoot"), "hub/postlikesupdate?format=json", postLikesUpdate); } catch (Exception ex) { _errorSignaler.SignalFromCurrentContext(ex); } }
public void Add(PostLike postLike) { var result = _postLikesLogic.Add(postLike); if (result != null && result.Error != null) throw new Exception(result.Error.Message); var postLikes = _postLikesLogic.Get(postLike.PostId); var postLikesUpdate = new PostLikesUpdate { PostId = postLike.PostId, PostLikes = postLikes, ClientFunction = Constants.SocketClientFunctions.PostLikesUpdate.ToString() }; _redisService.Publish(postLikesUpdate); }
public void PublishPostLikesUpdate(PostLikesUpdate postLikesUpdate) { _redisService.Publish(postLikesUpdate); }
public void PublishPostLikesUpdate(PostLikesUpdate postLikesUpdate) { throw new System.NotImplementedException(); }