public void SeedData() { if (!Categories.Any()) { var appliances = new Category() { Name = "Appliances", Subcategories = new List <Category>() { new Category() { Name = "Microwaves" } } }; Categories.Add(appliances); SaveChanges(); } if (!Cities.Any()) { Cities.AddRange( new City { Name = "New York" }, new City { Name = "Seattle" }, new City { Name = "San Francisco" }); SaveChanges(); } }
public override void Reload(GameCore core) { base.Reload(core); if (IsLoaded) { AllNations = new ObservableCollection <Nation>(core.QueryService.GetNations()); } Cities.Clear(); Cities.AddRange(core.QueryService.GetCities()); }
private void SeedCities() { var cities = new List <City> { new City { Id = 1, Name = "Stockholm", Currency = "KR" }, new City { Id = 2, Name = "Uppsala", Currency = "KR" } }; Cities.AddRange(cities); SaveChanges(); }
public void SeedData() { if (!Categories.Any()) { var appliances = new Category() { Name = "Appliances", SubCategories = new List <Category>() { new Category() { Name = "Microwaves" } } }; Categories.Add(appliances); SaveChanges(); } if (!Cities.Any()) { Cities.AddRange( new City { Name = "New York" }, new City { Name = "Seattle" }, new City { Name = "San Francisco" }); SaveChanges(); } if (!Users.Any()) { Users.AddRange( new User() { Id = "*****@*****.**" }, new User() { Id = "*****@*****.**" }, new User() { Id = "*****@*****.**" }, new User() { Id = "*****@*****.**" }); SaveChanges(); } //if (!Products.Any()) //{ // Products.AddRange( // new Product // { // Owner = Users.SingleOrDefault(u => u.Id == "*****@*****.**"), // Title = "Frigidaire", // Description =@"This classic top freezer refrigerator from Frigidaire is an excellent piece // for a starter kitchen. The Store-More™ door shelves featuring gallon storage offer plenty of // room for condiments and drinks.", // Category = Categories.SingleOrDefault(c => c.Name == "Appliances"), // City = Cities.SingleOrDefault(c => c.Name == "San Francisco"), // PublishDate = DateTime.Now // }, // new Product // { // Owner = Users.SingleOrDefault(u => u.Id == "*****@*****.**"), // Title = "Dyson V8 Absolute vacuum cleaner", // Description = @"The Dyson V8 Absolute vacuum cleaner has a soft roller cleaner head for // hard floors and a motorized cleaner head to remove dirt from carpets. In nickel/iron.", // Category = Categories.SingleOrDefault(c => c.Name == "Appliances"), // City = Cities.SingleOrDefault(c => c.Name == "Seattle"), // PublishDate = DateTime.Now // }, // new Product // { // Owner = Users.SingleOrDefault(u => u.Id == "*****@*****.**"), // Title = "Whirlpool", // Description = @"1.7 cu. ft. Over the Range Microwave in Stainless Steel with Electronic Touch Controls", // Category = Categories.SingleOrDefault(c => c.Name == "Microwaves"), // City = Cities.SingleOrDefault(c => c.Name == "New York"), // PublishDate = DateTime.Now // } // ); // SaveChanges(); //} }