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 }; }
public IEnumerable<UserViewModel> GetListUserLikedComment(string commentId) { var listUserIdLikedComment = this.GetListUserIdLikedComment(commentId); IUserRepository userRepository = new UserRepository(this._db); return userRepository.GetRangeUser(listUserIdLikedComment); }
public IEnumerable<UserViewModel> GetFriendList(string userId) { var userRepository = new UserRepository(this._db); return userRepository.GetRangeUser(this.GetFriendListId(userId)); }
public IEnumerable<UserViewModel> GetListUserLiked(string statusId) { var listUserIdLiked = this.GetListUserIdLiked(statusId); IUserRepository userRepository = new UserRepository(this._db); return userRepository.GetRangeUser(listUserIdLiked); }
private FriendSugestViewModel GetFriendSugest(IEnumerable<string> friendListId, string friendIdSugest) { IUserRepository userRepository = new UserRepository(this._db); var friendSugest = userRepository.GetUserById(friendIdSugest); var friendIdsMutual = GetListFriendMutualByUserID(friendListId, friendIdSugest); var listFriendMutual = userRepository.GetRangeUser(friendIdsMutual); return new FriendSugestViewModel { UserId = friendSugest.UserId, Displayname = friendSugest.Displayname, Avatar = friendSugest.Avatar, ListFriendMutual = listFriendMutual }; }