2024-05-29 17:24:55 +04:00
|
|
|
|
using BankBusinessLogic.BusinessLogics.Cashier;
|
|
|
|
|
using BankBusinessLogic.BusinessLogics.Client;
|
|
|
|
|
using BankBusinessLogic.BusinessLogics.Reports;
|
2024-05-28 04:18:31 +04:00
|
|
|
|
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;
|
2024-05-29 17:24:55 +04:00
|
|
|
|
using BankContracts.StoragesContracts.Cashier;
|
|
|
|
|
using BankContracts.StoragesContracts.Client;
|
|
|
|
|
using BankDatabaseImplement.Implements;
|
2024-05-28 04:18:31 +04:00
|
|
|
|
using BankDatabaseImplement.Implements.CashierImplements;
|
|
|
|
|
using BankDatabaseImplement.Implements.ClientImplements;
|
2024-05-29 17:24:55 +04:00
|
|
|
|
using Microsoft.OpenApi.Models;
|
2024-05-28 04:18:31 +04:00
|
|
|
|
|
2024-04-30 16:37:32 +04:00
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
|
|
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
|
|
|
|
builder.Logging.AddLog4Net("log4net.config");
|
|
|
|
|
|
|
|
|
|
// Add services to the container.
|
2024-05-29 17:24:55 +04:00
|
|
|
|
|
2024-05-28 04:18:31 +04:00
|
|
|
|
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>();
|
2024-04-30 16:37:32 +04:00
|
|
|
|
|
|
|
|
|
builder.Services.AddControllers();
|
2024-05-29 17:24:55 +04:00
|
|
|
|
|
2024-04-30 16:37:32 +04:00
|
|
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
2024-05-29 17:24:55 +04:00
|
|
|
|
|
|
|
|
|
builder.Services.AddSwaggerGen(c =>
|
|
|
|
|
{
|
|
|
|
|
c.SwaggerDoc("v1", new OpenApiInfo { Title = "BankRestAPI", Version = "v1" });
|
|
|
|
|
});
|
2024-04-30 16:37:32 +04:00
|
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
2024-05-29 17:24:55 +04:00
|
|
|
|
//Mails Service
|
2024-05-28 04:18:31 +04:00
|
|
|
|
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()),
|
|
|
|
|
});
|
|
|
|
|
|
2024-04-30 16:37:32 +04:00
|
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
|
|
|
{
|
2024-05-29 17:24:55 +04:00
|
|
|
|
app.UseSwagger();
|
|
|
|
|
|
|
|
|
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "BankRestAPI v1"));
|
2024-04-30 16:37:32 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
|
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
|
|
|
|
app.MapControllers();
|
|
|
|
|
|
2024-05-29 17:24:55 +04:00
|
|
|
|
app.Run();
|