public static void Initialize() { m_Context = new InventoryDbContext(); m_Context.Initialize(); m_ProductDataController = new ProductDataController(m_Context); m_CategoryDataController = new CategoryDataController(m_Context); m_CustomerDataController = new CustomerDataController(m_Context); m_TransactionDataController = new TransactionDataController(m_Context); m_StockDataController = new StockDataController(m_Context); m_VendorDataController = new VendorDataController(m_Context); m_purchaseDataController = new PurchaseDataController(m_Context); AddDefaultCategory(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, InventoryDbContext db, UserManager <ApplicationUser> userManager) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseIdentity(); db.Database.EnsureCreated(); if (db.Books.Count() == 0) { db.Initialize(userManager); } // Add external authentication middleware below. To configure them please see https://go.microsoft.com/fwlink/?LinkID=532715 app.UseMvc(routes => { routes.MapRoute( name: "areaRoutes", template: "{area:exists}/{controller=Home}/{action=Index}/{id?}"); routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }