public static void EnsureSeedDataForContext(this PersonInfoContext context) { if (context.People.Any()) { return; } var people = new List <Person>() { new Person() { FirstName = "Albert", LastName = "Einstein", Description = "Physicist who developed the theory of relativity.", Quotes = new List <Quote>() { new Quote() { Description = "You cannot blame gravity for falling in love." } } }, new Person() { FirstName = "Benjamin", LastName = "Franklin", Description = "One of the Founding Fathers of the United States.", Quotes = new List <Quote>() { new Quote() { Description = "Tell me and I forget. Teach me and I remember. Involve me and I learn." } } } }; context.People.AddRange(people); context.SaveChanges(); }
public bool Save() { return(_context.SaveChanges() >= 0); }