Ejemplo n.º 1
0
        public CommentViewModel GetCommentByCommentId(string commentId)
        {
            var comment = this._db.Comments.ToList().Find(cmt => cmt.CommentId == commentId);
            IUserRepository userRepository = new UserRepository(this._db);
            var userOwner = userRepository.GetUserById(comment.UserId);

            ILikeCommentRepositoty likeCommentRepository = new LikeCommentRepository(this._db);
            var listUserLiked = likeCommentRepository.GetListUserLikedComment(commentId);

            return
                new CommentViewModel
                {
                    CommentId = comment.CommentId,
                    TimeCommented = comment.TimeComment,
                    Content = ProcessComment.ProcessMessage(comment.Content),
                    UserOwner = userOwner,
                    ListUserLiked = listUserLiked
                };
        }
Ejemplo n.º 2
0
        public CommentViewModel GetCommentByCommentId(string commentId)
        {
            var             comment        = this._db.Comments.ToList().Find(cmt => cmt.CommentId == commentId);
            IUserRepository userRepository = new UserRepository(this._db);
            var             userOwner      = userRepository.GetUserById(comment.UserId);

            ILikeCommentRepositoty likeCommentRepository = new LikeCommentRepository(this._db);
            var listUserLiked = likeCommentRepository.GetListUserLikedComment(commentId);

            return
                (new CommentViewModel
            {
                CommentId = comment.CommentId,
                TimeCommented = comment.TimeComment,
                Content = ProcessComment.ProcessMessage(comment.Content),
                UserOwner = userOwner,
                ListUserLiked = listUserLiked
            });
        }