84 lines
3.3 KiB
C#
Raw Blame History

using BankBusinessLogic.BusinessLogic.Cashier;
using BankBusinessLogic.BusinessLogic.Client;
using BankBusinessLogic.BusinessLogic.Reports;
using BankBusinessLogic.MailWorker;
using BankBusinessLogic.OfficePackage;
using BankBusinessLogic.OfficePackage.Implements;
using BankContracts.BindingModels.Messages;
using BankContracts.BusinessLogicsContracts.Cashier;
using BankContracts.BusinessLogicsContracts.Client;
using BankContracts.BusinessLogicsContracts.Reports;
using BankContracts.StoragesModels.Cashier;
using BankContracts.StoragesModels.Client;
using BankDatabaseImplement.Implements.CashierImplements;
using BankDatabaseImplement.Implements.ClientImplements;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.SetMinimumLevel(LogLevel.Trace);
builder.Logging.AddLog4Net("log4net.config");
// Add services to the container.
builder.Services.AddTransient<IClientStorage, ClientStorage>();
builder.Services.AddTransient<ICashierStorage, CashierStorage>();
builder.Services.AddTransient<IAccountStorage, AccountStorage>();
builder.Services.AddTransient<ICardStorage, CardStorage>();
builder.Services.AddTransient<ICreditingStorage, CreditingStorage>();
builder.Services.AddTransient<IMoneyTransferStorage, MoneyTransferStorage>();
builder.Services.AddTransient<IDebitingStorage, DebitingStorage>();
builder.Services.AddTransient<ICashWithdrawalStorage, CashWithdrawalStorage>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<ICashierLogic, CashierLogic>();
builder.Services.AddTransient<IAccountLogic, AccountLogic>();
builder.Services.AddTransient<ICardLogic, CardLogic>();
builder.Services.AddTransient<ICreditingLogic, CreditingLogic>();
builder.Services.AddTransient<IMoneyTransferLogic, MoneyTransferLogic>();
builder.Services.AddTransient<IDebitingLogic, DebitingLogic>();
builder.Services.AddTransient<ICashWithdrawalLogic, CashWithdrawalLogic>();
builder.Services.AddTransient<IReportClientLogic, ReportClientLogic>();
builder.Services.AddSingleton<IReportCashierLogic, ReportCashierLogic>();
builder.Services.AddSingleton<MailKitWorker>();
//<2F><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
var mailSender = app.Services.GetService<MailKitWorker>();
mailSender?.MailConfig(new MailConfigBindingModel
{
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()),
});
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();