Exemple #1
0
        public async Task <ActionResult> Create([FromBody] CommentPostDto comment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Model state is not valid"));
            }

            await _commentManager.AddCommentAsync(comment);

            return(Ok());
        }
Exemple #2
0
 public async Task <ActionResult> Create([FromBody] NewCommentDto newCommentDto)
 {
     return(await HandleExceptions(async() =>
     {
         if (ModelState.IsValid)
         {
             await _commentManager.AddCommentAsync(newCommentDto);
             return Ok();
         }
         return BadRequest("Model state is not valid");
     }));
 }
 public Task <Guid> AddComment(Guid postId, [FromBody] SaveCommentModel model)
 {
     return(_commentManager.AddCommentAsync(postId, model));
 }