// Esse método é chamado pelo runtime. Use-o para configurar o pipeline da requisição HTTP. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ISeedingService seedingService) { seedingService.ObterLivros(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseCors(config => config .AllowAnyOrigin() .AllowAnyOrigin() .AllowAnyHeader()); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseSwagger(); app.UseSwaggerUI(config => { config.RoutePrefix = "swagger"; config.SwaggerEndpoint("/swagger/v1/swagger.json", "Doc v1"); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ISeedingService seedingService) { var enUs = new CultureInfo("en-US"); var localizationOptions = new RequestLocalizationOptions() { DefaultRequestCulture = new RequestCulture(enUs), SupportedCultures = new List <CultureInfo> { enUs }, SupportedUICultures = new List <CultureInfo> { enUs } }; app.UseRequestLocalization(localizationOptions); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); seedingService.Seed(); } else { app.UseExceptionHandler("/Home/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.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); endpoints.MapRazorPages(); }); }
public RestoringController(ISeedingService seedingService, ILogger <RestoringController> logger, IMediator mediator) { _seedingService = seedingService; _logger = logger; _mediator = mediator; }