using HotelBusinessLogic.BusinessLogics; using HotelBusinessLogic.MailWorker; using HotelBusinessLogic.OfficePackage; using HotelBusinessLogic.OfficePackage.Implements; using HotelContracts.BindingModels; using HotelContracts.BusinessLogicsContracts; using HotelContracts.StoragesContracts; using HotelDatabaseImplement.Implements; using HotelView; 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.AddSingleton(); builder.Services.AddSingleton(); var app = builder.Build(); var mailSender = app.Services.GetService(); mailSender?.MailConfig(new MailConfigBindingModel { MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value ?? string.Empty, MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value ?? string.Empty, SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value ?? string.Empty, SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value), PopHost = builder.Configuration?.GetSection("PopHost")?.Value ?? string.Empty, PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value) }); if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); app.Run();