using TravelAgencyBusinessLogic.BusinessLogics; using TravelAgencyBusinessLogic.OfficePackage.Implements; using TravelAgencyBusinessLogic.OfficePackage; using TravelAgencyContracts.BusinessLogicsContracts; using TravelAgencyContracts.StoragesContracts; using TravelAgencyDatabaseImplement.Implements; using TravelAgencyWebApp; using TravelAgencyBusinessLogic.MailWorker; System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllersWithViews(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddSingleton(); var app = builder.Build(); var mailSender = app.Services.GetService(); mailSender?.MailConfig(new() { MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value?.ToString() ?? string.Empty, MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty, SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty, SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()), PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty, PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString()) }); var guideLogic = app.Services.GetService(); var tripLogic = app.Services.GetService(); var placeLogic = app.Services.GetService(); var seeder = new SeedingService(guideLogic, tripLogic, placeLogic); seeder.SeedGuarantor(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { 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.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); app.Run();