Esempio n. 1
0
        public async Task <IActionResult> GetPostById(int postId)
        {
            var post = await _postService.GetPost(postId);

            if (post != null)
            {
                return(Ok(PostToPostViewModelMapper.PostToPostViewModel(post)));
            }
            return(NotFound());
        }
Esempio n. 2
0
        public async Task <IActionResult> Post([FromBody] IServices.Requests.CreatePost createPost)
        {
            var post = await _postService.CreatePost(createPost);

            return(Created(post.PostId.ToString(), PostToPostViewModelMapper.PostToPostViewModel(post)));
        }