Exemple #1
0
        public async Task <ActionResult> saveComments([FromBody] CommentsDTO comments)
        {
            if (comments == null)
            {
                return(BadRequest());
            }

            if (string.IsNullOrEmpty(comments.Comment))
            {
                return(Problem(statusCode: 422, title: "Invalida data, Comment property cannot be empty!"));
            }

            if (string.IsNullOrEmpty(comments.PostId.ToString()))
            {
                return(Problem(statusCode: 422, title: "Invalida data, PostId property cannot be empty!"));
            }

            return(Ok(await _commentsDomain.saveComments(comments)));
        }