示例#1
0
        public IActionResult Add(ArticleComment articleComment)
        {
            var result = _articleCommentService.Add(articleComment);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
示例#2
0
        public IActionResult AddComment(int id, [FromBody] ArticleCommentCreate articleCommentCreate)
        {
            if (articleCommentCreate == null)
            {
                throw new ApiException("Błąd danych parametru");
            }

            if (!ModelState.IsValid)
            {
                throw new ApiValidationException("Walidacja");
            }

            if (!_articleCommentService.Add(id, articleCommentCreate))
            {
                throw new ApiException("Wystąpił bład podczas dodawania komentarza");
            }

            return(new ResponseObjectResult("Akcja wykonana porawnie"));
        }