예제 #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);
        }
예제 #2
0
        public static string GetHtml_statusBoxLikeShare(string statusId, string userId)
        {
            ApplicationDbContext dbContext = new ApplicationDbContext();
            ILikeRepository likeRepository = new LikeRepository(dbContext);

            int isLike = likeRepository.IsLiked(statusId, userId);
            string strLike = (isLike == 1) ? "unlike" : "like";

            return
            "<div class='box-like-share'>"
                + "<a class='like' data-isliked='" + isLike + "' data-statusid='" + statusId + "'>"
                    + strLike
                + "</a> &nbsp;<span data-statusid='" + statusId + "' class='glyphicon glyphicon-thumbs-up icon-liked' data-toggle='modal' data-target='#liked'></span> <span id='numLike-" + statusId + "'>" + likeRepository.Count(statusId) + "</span>"
                + "&nbsp;.&nbsp;"
                + "<a class='share' data-statusid='" + statusId + "'>Share</a> &nbsp;<span class='glyphicon glyphicon-share-alt'></span> <span id='numShare-" + statusId + "'>0</span>"
            + "</div>";
        }
예제 #3
0
 public JsonResult GetPeopleLiked(string statusId)
 {
     ILikeRepository likeRepository = new LikeRepository(_dbContext);
     var listUserLiked = likeRepository.GetListUserLiked(statusId);
     return Json(listUserLiked, JsonRequestBehavior.AllowGet);
 }