CourseWork_BankYouBankrupt/BankYouBankrupt/BankYouBankruptRestAPI/Program.cs

58 lines
2.1 KiB
C#
Raw Normal View History

using BankYouBankruptBusinessLogic.BusinessLogics;
using BankYouBankruptContracts.BusinessLogicsContracts;
using BankYouBankruptContracts.StoragesContracts;
using BankYouBankruptDatabaseImplement.Implements;
using Microsoft.OpenApi.Models;
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>();
2023-05-14 14:00: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>();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "BankYouBankruptRestAPI", Version = "v1" });
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "BankYouBankruptRestAPI v1"));
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();