2024-05-04 21:53:45 +04:00
|
|
|
using SushiBarBusinessLogic.BusinessLogics;
|
2024-05-22 09:32:20 +04:00
|
|
|
using SushiBarBusinessLogic.MailWorker;
|
|
|
|
using SushiBarContracts.BindingModels;
|
2024-05-04 21:53:45 +04:00
|
|
|
using SushiBarContracts.BusinessLogicsContracts;
|
|
|
|
using SushiBarContracts.StoragesContracts;
|
|
|
|
using SushiBarDatabaseImplement.Implements;
|
2024-05-22 09:32:20 +04:00
|
|
|
using static Org.BouncyCastle.Math.EC.ECCurve;
|
2024-05-04 21:53:45 +04:00
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
|
builder.Logging.SetMinimumLevel(LogLevel.Information);
|
|
|
|
builder.Logging.AddLog4Net("log4net.config");
|
|
|
|
|
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddSingleton<IClientStorage, ClientStorage>();
|
|
|
|
builder.Services.AddSingleton<IOrderStorage, OrderStorage>();
|
|
|
|
builder.Services.AddSingleton<ISushiStorage, SushiStorage>();
|
|
|
|
builder.Services.AddSingleton<IOrderLogic, OrderLogic>();
|
|
|
|
builder.Services.AddSingleton<IClientLogic, ClientLogic>();
|
|
|
|
builder.Services.AddSingleton<ISushiLogic, SushiLogic>();
|
|
|
|
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();
|
|
|
|
|
2024-05-22 09:32:20 +04:00
|
|
|
MailConfigBindingModel? mailSender = builder.Configuration.GetSection("MailConfigBindingModel").Get<MailConfigBindingModel>();
|
|
|
|
app.Services.GetService<AbstractMailWorker>()?.MailConfig(mailSender!);
|
|
|
|
|
2024-05-04 21:53:45 +04:00
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
|
|
{
|
|
|
|
app.UseSwagger();
|
|
|
|
app.UseSwaggerUI();
|
|
|
|
}
|
|
|
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
|
|
app.MapControllers();
|
|
|
|
|
|
|
|
app.Run();
|