private async Task AddBookAsync(string title, string publisher) { using (var context = new BooksContext()) { var book = new Book { Title = title, Publisher = publisher }; context.Add(book); int records = await context.SaveChangesAsync(); WriteLine($"{records} record added"); } WriteLine(); }
private static async Task AddBookAsync() { using (var context = new BooksContext()) { var b = new Book { Title = BookTitle, Publisher = "Sample" }; context.Add(b); int records = await context.SaveChangesAsync(); WriteLine($"{records} record added"); } WriteLine(); }