Inheritance: BaseObject
Exemplo n.º 1
0
 public void Add(PostLike postLike)
 {
     using (var svc = new ServiceProxyHelper<IPostLikesService>("PostLikesService"))
     {
         svc.Proxy.Add(postLike);
     }
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public PostLike Add(PostLike postLike)
        {
            try
            {
                var tmpPostLike = _postLikeRepository.Find(a => a.PostId == postLike.PostId && a.UserId == postLike.UserId, false).ToList();
                if (tmpPostLike.Count > 0)
                {
                    _postLikeRepository.Delete(tmpPostLike.FirstOrDefault());
                    return null;
                }

                return PostLikeMapper.ToDto(_postLikeRepository.Add(PostLikeMapper.ToEntity(postLike)));
            }
            catch (Exception ex)
            {
                throw new BlogException(ex.Message, ex.InnerException);
            }
        }
Exemplo n.º 4
0
        public void Post([FromUri]int postId, string username)
        {
            try
            {
                var user = _user.GetByUserName(username);
                var loggedUser = _user.GetByUserName(User.Identity.Name);
                if (loggedUser.Id != user.Id) throw new HttpResponseException(HttpStatusCode.Forbidden);

                var postLike = new PostLike
                               {
                                   PostId = postId,
                                   UserId = user.Id
                               };
                _service.Add(postLike);
            }
            catch (Exception ex)
            {
                _errorSignaler.SignalFromCurrentContext(ex);
            }
        }
 public void Add(PostLike postLike, string authenticationToken)
 {
     throw new System.NotImplementedException();
 }