public Author CreateAuthor([Service] BooksContext context, AuthorAndBook authorAndBook) { var author = new Author() { Name = authorAndBook.AuthorName, Books = new List <Book> { new Book { Title = authorAndBook.Title } } }; context.Authors.Add(author); context.SaveChanges(); return(author); }
public Author CreateAuthorWithArgumentDescription([Service] BooksContext context, [GraphQLDescription("Argument description: Author with a book description")] AuthorAndBook authorAndBook) { var author = new Author() { Name = authorAndBook.AuthorName, Books = new List <Book> { new Book { Title = authorAndBook.Title } } }; context.Authors.Add(author); context.SaveChanges(); return(author); }