public static async Task Read(DoctorContext context) { if (await context.Doctors.AnyAsync()) { Console.WriteLine("Doctors from AnimalsContext"); foreach (var doc in context.Doctors) { Console.WriteLine($"Id: {doc.Id} | Name: {doc.Name} | Medical Doctor? {doc.IsMedical} | Tardis? {doc.HasTardis}"); } } }
public static async Task Seed(DoctorContext context) { if (await context.Doctors.AnyAsync()) { return; } Console.WriteLine("Seeding doctor data"); var cars = new List <DoctorModel> { new DoctorModel("House", true, false), new DoctorModel("Hawking", false, false), new DoctorModel("Crusher", true, false), new DoctorModel("Who", false, true) }; context.Doctors.AddRange(cars); await context.SaveChangesAsync(); }