Exemplo n.º 1
0
        public void CreateInitialDatabase(ShoppingDb context)
        {
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            var camera = new Product {
                Name = "Canon EOS 70D", Price = 599m
            };
            var microphone = new Product {
                Name = "Shure SM7B", Price = 245m
            };
            var light = new Product {
                Name = "Key Light", Price = 59.99m
            };
            var phone = new Product {
                Name = "Android Phone", Price = 259.59m
            };
            var speakers = new Product {
                Name = "5.1 Speaker System", Price = 799.99m
            };

            context.Products.Add(camera);
            context.Products.Add(microphone);
            context.Products.Add(light);
            context.Products.Add(phone);
            context.Products.Add(speakers);

            context.SaveChanges();
        }
Exemplo n.º 2
0
 public virtual void SaveChanges()
 {
     _shoppingDb.SaveChanges();
 }