public static void Initialize(IServiceProvider serviceProvider) { using (var context = new hw3Context( serviceProvider.GetRequiredService< DbContextOptions<hw3Context>>())) { if (context.Author.Any() || context.Quote.Any()) { return; // DB has been seeded } context.Quote.AddRange( new Quote { Quotation = "Whatever will be will be, the future is not ours to see", }, new Quote { Quotation = "Que Sera Sera", } ); context.SaveChanges(); context.Author.AddRange( new Author { AuthorName = "Doris Day", }, new Author { AuthorName = "Dan Alves", } ); context.SaveChanges(); } }
public DeleteModel(hw3.Data.hw3Context context) { _context = context; }
public EditModel(hw3.Data.hw3Context context) { _context = context; }
public DetailsModel(hw3.Data.hw3Context context) { _context = context; }
public CreateModel(hw3.Data.hw3Context context) { _context = context; }
public IndexModel(hw3.Data.hw3Context context) { _context = context; }