Пример #1
0
        public StatusViewModel GetStatusViewModelByStatusId(string statusId)
        {
            Status status = this.GetStatusByStatusId(statusId);
            IStatusLocationRepository sttLocation          = new StatusLocationRepository(this._db);
            IStatusMessageRepository  sttMessageRepository = new StatusMessageRepository(this._db);
            IStatusImageRepository    sttImageRepository   = new StatusImageRepository(this._db);
            IUserRepository           userRepository       = new UserRepository(this._db);
            ILikeRepository           likeRepository       = new LikeRepository(this._db);
            IShareRepository          shareRepository      = new ShareRepository(this._db);
            ICommentRepository        commentRepository    = new CommentRepository(this._db);

            var message          = sttMessageRepository.GetMessageByStatusId(statusId);
            var messageProcessed = ProcessComment.ProcessMessage(message);

            LinkPreview linkPreview = ProcessMessage.GetFirstLinkPreview(message);

            var userOwner = userRepository.GetUserById(status.UserId);

            var statusViewModel = new
                                  StatusViewModel
            {
                StatusId      = statusId,
                TimePost      = status.TimePost,
                Location      = sttLocation.GetLocationForStatus(statusId),
                Message       = messageProcessed,
                Images        = sttImageRepository.GetListImage(statusId),
                UserOwner     = userOwner,
                LinkPreview   = linkPreview,
                NumShared     = shareRepository.GetNumShare(statusId),
                ListUserLiked = likeRepository.GetListUserLiked(statusId)
            };

            return(statusViewModel);
        }