// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { var dbContext = new SimpleStockAppDataContext(); dbContext.Database.EnsureCreated(); dbContext.Database.Migrate(); if (dbContext.Stocks.Count() == 0) { DbInitializer.SeedDatabase(dbContext); } if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMvc(); }
public IndexController(SimpleStockAppDataContext dataContext) { this.dataContext = dataContext; }
public StockController(SimpleStockAppDataContext simpleStockAppDataContext) { this.simpleStockAppDataContext = simpleStockAppDataContext; }