2023-04-01 23:47:54 +04:00
|
|
|
|
using BankYouBankruptBusinessLogic.BusinessLogics;
|
|
|
|
|
using BankYouBankruptContracts.BusinessLogicsContracts;
|
|
|
|
|
using BankYouBankruptContracts.StoragesContracts;
|
|
|
|
|
using BankYouBankruptDatabaseImplement.Implements;
|
|
|
|
|
using Microsoft.OpenApi.Models;
|
|
|
|
|
|
2023-03-31 20:13:22 +04:00
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
2023-04-01 23:47:54 +04:00
|
|
|
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
|
|
|
|
builder.Logging.AddLog4Net("log4net.config");
|
|
|
|
|
|
2023-03-31 20:13:22 +04:00
|
|
|
|
// Add services to the container.
|
|
|
|
|
|
2023-04-01 23:47:54 +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>();
|
2023-04-02 01:17:44 +04:00
|
|
|
|
builder.Services.AddTransient<IMoneyTransferStorage, MoneyTransferStorage>();
|
|
|
|
|
builder.Services.AddTransient<IDebitingStorage, DebitingStorage>();
|
|
|
|
|
builder.Services.AddTransient<ICashWithdrawalStorage, CashWithdrawalStorage>();
|
2023-04-01 23:47:54 +04:00
|
|
|
|
|
|
|
|
|
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
2023-04-02 01:17:44 +04:00
|
|
|
|
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>();
|
2023-04-01 23:47:54 +04:00
|
|
|
|
|
2023-03-31 20:13:22 +04:00
|
|
|
|
builder.Services.AddControllers();
|
2023-04-01 23:47:54 +04:00
|
|
|
|
|
2023-03-31 20:13:22 +04:00
|
|
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
2023-04-01 23:47:54 +04:00
|
|
|
|
|
|
|
|
|
builder.Services.AddSwaggerGen(c =>
|
|
|
|
|
{
|
2023-04-02 01:17:44 +04:00
|
|
|
|
c.SwaggerDoc("v1", new OpenApiInfo { Title = "BankYouBankruptRestAPI", Version = "v1" });
|
2023-04-01 23:47:54 +04:00
|
|
|
|
});
|
2023-03-31 20:13:22 +04:00
|
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
|
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
|
|
|
{
|
|
|
|
|
app.UseSwagger();
|
2023-04-01 23:47:54 +04:00
|
|
|
|
|
2023-04-02 01:17:44 +04:00
|
|
|
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "BankYouBankruptRestAPI v1"));
|
2023-03-31 20:13:22 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
|
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
|
|
|
|
app.MapControllers();
|
|
|
|
|
|
2023-04-01 23:47:54 +04:00
|
|
|
|
app.Run();
|