// 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, CheeseDbContext context) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Cheese}/{action=Index}/{id?}"); }); context.Database.EnsureCreated(); }
public CheeseController(CheeseDbContext dbContext) { context = dbContext; }
public CategoryController(CheeseDbContext dbContext) { context = dbContext; }
public MenuController(CheeseDbContext dbContext) { context = dbContext; }
public CheeseController(CheeseDbContext dbContext) { //add the this. this.context = dbContext; }
//constructor that takes instance of DKcontext public CheeseController(CheeseDbContext dbContext) { //set field to be equal to Db context that is passed in to it context = dbContext; }
public CategoryController(CheeseDbContext dbContext) //Placing it in Contrsuctor { context = dbContext; }