Ejemplo n.º 1
0
        public IActionResult AddArticle([FromBody] AddArticleToAuthorInputModel input, string id)
        {
            if (!input.IsValid())
            {
                return(BadRequest(input.ValidationMessage));
            }
            var author = _authorAppService.GetAuthor(id);

            if (author == null)
            {
                return(BadRequest("Author not found"));
            }

            var article = _authorAppService.AddArticle(input, id);

            return(Created(new Uri($"/articles/{article.Id}", UriKind.Relative), article));
        }