public async Task <ActionResult <Author> > CreateAuthor(
            [FromBody] Author author
            )
        {
            _dbContext.Authors.Add(author);
            await _dbContext.SaveChangesAsync();

            return(StatusCode(201, author));
        }
Example #2
0
        public async Task <ActionResult <Genre> > CreateGenre(
            [FromBody] Genre genre
            )
        {
            _dbContext.Genres.Add(genre);
            await _dbContext.SaveChangesAsync();

            return(StatusCode(201, genre));
        }
Example #3
0
        public async Task <ActionResult <Author> > CreateAuthor(
            [FromBody] Book book
            )
        {
            _dbContext.Books.Add(book);
            await _dbContext.SaveChangesAsync();

            return(StatusCode(201, book));
        }