Exemplo n.º 1
0
        public IEnumerable <PostModel> GetPostsPage(int page)
        {
            var posts = postRepository.Get()
                        .OrderByDescending(p => p.DateCreated)
                        .Skip(coreConfig.PageSize * (page - 1))
                        .Take(coreConfig.PageSize)
                        .ToList();

            return(postsTransformer.Transform(posts));
        }
Exemplo n.º 2
0
 public IEnumerable <ProfileModel> GetTopContributors()
 {
     return(profilesTransformer.Transform(profileRepository.Get()
                                          .OrderByDescending(u => u.Posts.Count())
                                          .Take(coreConfig.TopStats)
                                          .ToList()));
 }
 public PostModel Transform(Post source)
 {
     return(new PostModel
     {
         DateCreated = source.DateCreated,
         Id = source.Id,
         IsNSFW = source.IsNSFW,
         Title = source.Title,
         Owner = profileTransformer.Transform(source.Owner),
         Votes = votesTransformer.Transform(source.Votes).ToList(),
         Content = contentTransformer.Transform(source.Content),
         Comments = commentsTransfomer.Transform(source.Comments).ToList()
     });
 }