Beispiel #1
0
        public async Task <PostsList <Post> > GetPostsList(PostsListParams postsListParams)
        {
            var posts = context.Posts
                        .OrderByDescending(o => o.DateAdded)
                        .AsQueryable();

            return(await PostsList <Post> .CreateAsync(posts, postsListParams.PartNumber, postsListParams.PartSize));
        }
Beispiel #2
0
        public async Task <IActionResult> GetPosts([FromQuery] PostsListParams postsListParams)
        {
            var posts = await service.GetPostsList(postsListParams);

            var postToReturn = mapper.Map <IEnumerable <PostToReturnDto> >(posts);

            Response.AddPostHeader(posts.CurrentPart, posts.PartSize);
            return(Ok(postToReturn));
        }