Esempio n. 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());
        }
Esempio n. 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");
     }));
 }
Esempio n. 3
0
 public Task <Guid> AddComment(Guid postId, [FromBody] SaveCommentModel model)
 {
     return(_commentManager.AddCommentAsync(postId, model));
 }