// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, OdeToFoodDBContext context, ILogger <Startup> logger) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } //app.Use(SayHelloMiddleWare); var DropRecreate = false; if (DropRecreate) { string FileName = $"{ Directory.GetCurrentDirectory()}\\DataAccess\\OdeToFoodDbBackUp.sql"; Backup(FileName, logger); context.Database.EnsureDeleted(); context.Database.EnsureCreated(); ExecBackup(FileName, logger); } app.UseHttpsRedirection(); app.Use(Next => { return(async ctx => { if (ctx.Request.Path.StartsWithSegments("/hello")) { ctx.Response.Redirect("/Resturants/List"); } else { await Next.Invoke(ctx); } }); }); app.UseStaticFiles(); app.UseNodeModules(); app.UseCookiePolicy(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); endpoints.MapControllers(); }); }
public SqlRestaurantData(OdeToFoodDBContext context) { _context = context; }
public RestaurantsController(OdeToFoodDBContext context) { _context = context; }
public SqlResturantData(OdeToFoodDBContext db) { this.db = db; }
public IndexModel(OdeToFoodDBContext context) { _context = context; }