public void Add(PostLike postLike) { using (var svc = new ServiceProxyHelper<IPostLikesService>("PostLikesService")) { svc.Proxy.Add(postLike); } }
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 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); } }
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(); }