Exemplo n.º 1
0
        public IActionResult Add(ArticleComment articleComment)
        {
            var result = _articleCommentService.Add(articleComment);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Exemplo n.º 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"));
        }