// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger logger) { PrepareDB.PreparePopulation(app).Wait(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.ConfigureExceptionHandler(logger); //else //{ // app.UseExceptionHandler(appBuilder => // { // appBuilder.Run(async context => // { // // ensure generic 500 status code on fault. // context.Response.StatusCode = StatusCodes.Status500InternalServerError; ; // await context.Response.WriteAsync("An unexpected fault happened. Try again later."); // }); // }); // // 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.UseAuthentication(); //loggerFactory.AddFile(Configuration.GetSection("Logging")); //app.UseMvc(routes => //{ // routes.MapRoute( // name: "default", // template: "{controller=Home}/{action=Index}/{id?}"); //}); app.UseCors(MyAllowSpecificOrigins); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); //app.UseStaticFiles(); //app.UseMvc(); //eventsDbContext.Database.Migrate(); // Start Scrapper Service whe application start, and stop it when stopping //appLifetime.ApplicationStarted.Register(scrapingService.Start); //appLifetime.ApplicationStarted.Register( () => log.LogInformation("Application Started")); //appLifetime.ApplicationStopping.Register(scrapingService.Stop); //appLifetime.ApplicationStopping.Register(() => log.LogInformation("Application Stopping")); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); PrepareDB.PreparePopulation(app); }
public ActionResult Detail(string ID) { Models.Blog blog = PrepareDB.selectBlog(ID); return(View(blog)); }
public ActionResult Category() { List <Models.Category> cat = PrepareDB.selectListCategorys(20); return(View(cat)); }