using BankBusinessLogic.BusinessLogics; using BankContracts.BusinessLogicsContracts; using BankContracts.StoragesContracts; using BankDatabaseImplement.Implements; using BankBusinessLogic.OfficePackage; using BankBusinessLogic.OfficePackage.Implements; using OperatorApp; using BankBusinessLogic.MailWorker; using BankContracts.BindingModels; 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.AddSingleton(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); builder.Services.AddTransient(); var app = builder.Build(); try { var mailSender = app.Services.GetService(); mailSender?.MailConfig(new MailConfigBindingModel { MailLogin = builder.Configuration["MailLogin"] ?? string.Empty, MailPassword = builder.Configuration["MailPassword"] ?? string.Empty, SmtpClientHost = builder.Configuration["SmtpClientHost"] ?? string.Empty, SmtpClientPort = Convert.ToInt32(builder.Configuration["SmtpClientPort"]), PopHost = builder.Configuration["PopHost"] ?? string.Empty, PopPort = Convert.ToInt32(builder.Configuration["PopPort"]) }); } catch (Exception ex) { var logger = app.Services.GetService(); logger?.LogError(ex, "Ошибка работы с почтой"); } APIClient.Connect(builder.Configuration); // 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();