Example #1
0
        public void Seed(TeaShopContext context)
        {
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            context.TeaInventory.AddRange(
                new TeaInventory()
            {
                TeaName = "Orange Juice", TeaDescription = "Orange Tree", TeaPrice = "50"
            },
                new TeaInventory()
            {
                TeaName = "Mango Juice", TeaDescription = "Mango Tree", TeaPrice = "250"
            },
                new TeaInventory()
            {
                TeaName = "Apple Juice", TeaDescription = "Apple Tree", TeaPrice = "150"
            },
                new TeaInventory()
            {
                TeaName = "Ice Tea", TeaDescription = "ice Tea", TeaPrice = "90"
            },
                new TeaInventory()
            {
                TeaName = "Cold Coffee", TeaDescription = "Orange Tree", TeaPrice = "140"
            }
                );
            context.SaveChanges();
        }
        public TeaInventoryFakeController()
        {
            var context = new TeaShopContext(dbContextOptions);
            DummyDataDBInitializer db = new DummyDataDBInitializer();

            db.Seed(context);

            repository = new TeaInventoryRepository(context);
        }
 public TeaInventoryRepository(TeaShopContext _db)
 {
     db = _db;
 }
Example #4
0
 public DbRepositorySQL(TeaShopContext context)
 {
     _contextDb = context;
     _dbSet     = context.Set <TEntity>();
 }