Ejemplo n.º 1
0
        public async Task <IActionResult> GetMainpagePosts([FromBody] GetMainpagePostsDto data)
        {
            var request = new GetPostsRequest
            {
                CurrentUserUuid = User.Identity.Name,
                FriendsUuid     = data.MyFriendsUuids,
                Destination     = PostDestination.MainPage,
                Page            = data.Page,
                LastPostFetched = data.LastPostFetched
            };
            var posts = await _mediator.Send(request);

            return(Ok(posts));
        }
Ejemplo n.º 2
0
        private async Task <IEnumerable <PostDto> > GetPosts(IEnumerable <string> myFriendsUuids, GetMainpagePosts request)
        {
            var dto = new GetMainpagePostsDto
            {
                LastPostFetched = request.LastPostFetched,
                Page            = request.Page,
                MyFriendsUuids  = myFriendsUuids
            };

            var content = new StringContent(
                JsonConvert.SerializeObject(dto),
                Encoding.UTF8,
                "application/json");

            var result = await _http.Post("posts", "/GetMainpagePosts", content);

            return(JsonConvert.DeserializeObject <IEnumerable <PostDto> >(result));
        }