Exemple #1
0
        public async Task Post([FromBody] PostInputModel postInput)
        {
            var post = new Post(Guid.NewGuid(), postInput.Body);

            try
            {
                await postsService.AddAsync(post);
            }
            catch (PostValidationException e)
            {
                logger.LogError($"PostValidationException <{e.Message}> {e.InvalidAttribute}");
                throw;
            }
        }
 public async Task <PostDTO> AddPostAsync([FromBody] PostDTO post)
 {
     return(await service.AddAsync(post));
 }