Exemple #1
0
        public List <UserPostViewModel> GetAllPosts()
        {
            List <UserPostViewModel> userPosts = Mapper.ConvertPostsToViewPost(_postsRepository.GetAllPosts());

            foreach (var post in userPosts)
            {
                post.CommentsCount = _commentsRepository.CountOfComments(post.Id);
                post.DislikesCount = PostDislikes(post.Id);
                post.LikesCount    = PostLikes(post.Id);
            }
            return(userPosts);
        }
Exemple #2
0
        public IEnumerable <Post> GetAll()
        {
            IEnumerable <Post> posts = _repo.GetAllPosts();

            return(posts);
        }