Пример #1
0
        public async Task <ActionResult <Author> > PostAuthor([FromBody] Author author)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var createdAuthor = await authorsService.CreateAuthorAsync(author);

            return(Created($"/api/authors/{createdAuthor.Id}", createdAuthor));
        }
Пример #2
0
        public async Task <IActionResult> Post([FromBody] AuthorDTO author)
        {
            await service.CreateAuthorAsync(author);

            return(Ok());
        }