Ejemplo n.º 1
0
        public List <ClientPost> GetMyPosts(string userId)
        {
            List <Post>       posts         = _graphDB.GetMyPosts(userId);
            List <ClientPost> postsToClient = new List <ClientPost>();

            foreach (var post in posts)
            {
                ClientPost         clientPost   = new ClientPost(post);
                List <Comment>     postComments = _graphDB.GetCommentsForPost(post.PostID);
                List <MainComment> mainComments = new List <MainComment>();
                foreach (var comment in postComments)
                {
                    MainComment mainComment = new MainComment
                    {
                        Comment      = comment,
                        CommentOwner = _graphDB.GetCommentOwner(comment.CommentID),
                        IsLike       = _graphDB.IsUserLikeComment(userId, comment.CommentID)
                    };

                    mainComments.Add(mainComment);
                    //comment.UsersLike = _graphDB.GetLikesForComment(comment.CommentID);
                }
                clientPost.Comments  = mainComments;
                clientPost.PostOwner = _graphDB.GetPostOwner(post.PostID);
                clientPost.IsLike    = _graphDB.IsUserLikePost(userId, post.PostID);

                List <User> usersLike = _graphDB.GetLikesForPost(post.PostID);
                clientPost.UsersLikes = _graphDB.GetLikesForPost(post.PostID);
                clientPost.LikeCount  = usersLike.Count;
                postsToClient.Add(clientPost);
            }
            return(postsToClient);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            CourierSystem          editor   = new CourierSystem();
            PackageSystem          spelling = new PackageSystem();
            PaymentSystem          post     = new PaymentSystem();
            FacadePostClientSystem facade   = new FacadePostClientSystem(editor, spelling, post);

            ClientPost.ClientCode(facade);
            Console.ReadLine();
        }
Ejemplo n.º 3
0
        public OperationResult <ClientPostDTO> Add(ClientPost newClient)
        {
            var sqlServerClientRepository = _sqlUnitOfWork.GetRepository <IClientSQLServerRepository>();
            var client = _mapper.Map <Client>(newClient);

            client.Id = Guid.NewGuid();

            var dataResult = sqlServerClientRepository.Add(client);

            _sqlUnitOfWork.Save();

            var result = new OperationResult <ClientPostDTO>
            {
                Type   = dataResult.Type,
                Errors = dataResult.Errors,
                Data   = _mapper.Map <ClientPostDTO>(dataResult.Data)
            };

            return(result);
        }
Ejemplo n.º 4
0
 public SendPostSuccessAction(ClientPost newPost)
 {
     NewPost = newPost;
 }