2024-05-27 21:03:42 +04:00
|
|
|
using BusinessLogic.BusinessLogic;
|
|
|
|
using Contracts.BusinessLogicsContracts;
|
|
|
|
using Contracts.StoragesContracts;
|
|
|
|
using DatabaseImplement.Implements;
|
|
|
|
using GuarantorAPP;
|
|
|
|
|
2024-04-30 00:42:26 +04:00
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
|
builder.Services.AddControllersWithViews();
|
|
|
|
|
2024-05-27 21:03:42 +04:00
|
|
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
|
|
|
builder.Logging.AddLog4Net("log4net.config");
|
|
|
|
|
|
|
|
builder.Services.AddTransient<IGuarantorStorage, GuarantorStorage>();
|
|
|
|
builder.Services.AddTransient<IWorkerStorage, WorkerStorage>();
|
|
|
|
builder.Services.AddTransient<IWorkshopStorage, WorkshopStorage>();
|
|
|
|
builder.Services.AddTransient<IMachineStorage, MachineStorage>();
|
|
|
|
builder.Services.AddTransient<IProductionStorage, ProductionStorage>();
|
|
|
|
builder.Services.AddTransient<IGuarantorLogic, GuarantorLogic>();
|
|
|
|
builder.Services.AddTransient<IWorkerLogic, WorkerLogic>();
|
|
|
|
builder.Services.AddTransient<IWorkshopLogic, WorkshopLogic>();
|
|
|
|
builder.Services.AddTransient<IMachineLogic, MachineLogic>();
|
|
|
|
builder.Services.AddTransient<IProductionLogic, ProductionLogic>();
|
|
|
|
builder.Services.AddTransient<GuarantorData>();
|
|
|
|
|
|
|
|
builder.Services.AddSession(options =>
|
|
|
|
{
|
|
|
|
options.IdleTimeout = TimeSpan.FromMinutes(30);
|
|
|
|
options.Cookie.HttpOnly = true;
|
|
|
|
options.Cookie.IsEssential = true;
|
|
|
|
});
|
|
|
|
|
2024-04-30 00:42:26 +04:00
|
|
|
var app = builder.Build();
|
|
|
|
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
|
|
{
|
|
|
|
app.UseExceptionHandler("/Home/Error");
|
|
|
|
app.UseHsts();
|
|
|
|
}
|
|
|
|
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseStaticFiles();
|
|
|
|
|
|
|
|
app.UseRouting();
|
|
|
|
|
2024-05-27 21:03:42 +04:00
|
|
|
app.UseSession();
|
2024-04-30 00:42:26 +04:00
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
|
|
app.MapControllerRoute(
|
|
|
|
name: "default",
|
|
|
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
|
|
|
|
2024-05-27 21:03:42 +04:00
|
|
|
app.Run();
|