コード例 #1
0
        private Object Savelike(int postId, string user)
        {
            var postService = new PostService(null);
            var item        = postService.GetPostById(postId);
            var liked       = new Likes
            {
                Id     = 0,
                PostId = item.Id,
                UserId = user,
            };

            postService.AddLike(liked);
            var post = postService.GetPostById(postId);
            var anom = new
            {
                id    = post.Id,
                count = post.Likes.Count(),
                type  = true
            };

            return(anom);
        }