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); }
public IEnumerable <Post> GetAll() { IEnumerable <Post> posts = _repo.GetAllPosts(); return(posts); }