Example #1
0
        public async Task <IActionResult> Get(string slug)
        {
            var    token  = GetToken();
            string userId = null;

            if (!string.IsNullOrEmpty(token))
            {
                userId = LoginHelper.GetClaim(token, "UserId");
            }

            var post = await _postAppService.GetPostById(slug, userId == null?Guid.Empty : Guid.Parse(userId));

            return(Ok(post));
        }
Example #2
0
 public async Task <PostDto> GetPost(long id)
 {
     return(await _postAppService.GetPostById(id));
 }