public static void Initialize(ContosoPetsContext context) { if (!context.Products.Any()) { context.Products.AddRange( new Product { Name = "Squeaky Bone", Price = 20.99m }, new Product { Name = "Knotted Rope", Price = 12.99m }, new Product { Name = "Tecno Phone", Price = 12.12m } ); context.SaveChanges(); } }
public static void Initialize(ContosoPetsContext context) { if (!context.Products.Any()) { context.Products.AddRange( new Product { Name = "Squeaky Bone", Price = 20.99m }, new Product { Name = "Knotted Rope", Price = 12.99m }, new Product { Name = "added item", Price = 1.00m, Size = "small" } ); context.SaveChanges(); } }
public static void Initialize(ContosoPetsContext context) { if (!context.Products.Any()) { context.Products.AddRange( new(0, "Squeaky Bone", 20.99m), new(0, "Knotted Rope", 12.99m) ); context.SaveChanges(); } }
public static void Initialize(ContosoPetsContext context) { if (!context.Locations.Any()) { context.Locations.AddRange( new MyLocationAPI { Address = "Male", Description = "red", }, new MyLocationAPI { Address = "Male", Description = "red" } ); context.SaveChanges(); } }
public static void Initialize(ContosoPetsContext context) { if (!context.Produtos.Any()) { context.Produtos.AddRange( new Produto { Id = 0, Nome = "Squeaky Bone", Preco = 20.99m }, new Produto { Id = 0, Nome = "Knotted Rope", Preco = 12.99m } ); context.SaveChanges(); } }