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

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

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

            return(StatusCode(201, book));
        }