55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
using UniversityBusinessLogics.BusinessLogic;
|
|
using UniversityContracts.BusinessLogicContracts;
|
|
using UniversityContracts.StoragesContracts;
|
|
using UniversityDatabaseImplement.Implements;
|
|
using Serilog;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.AddControllersWithViews();
|
|
builder.Services.AddSession(); // Äîáàâëÿåì ñåññèþ äëÿ àâòîðèçàöèè
|
|
|
|
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
|
builder.Services.AddTransient<IPurchaseLogic, PurchaseLogic>();
|
|
builder.Services.AddTransient<IClassLogic, ClassLogic>();
|
|
builder.Services.AddTransient<IPaymentLogic, PaymentLogic>();
|
|
|
|
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
|
builder.Services.AddTransient<IPurchaseStorage, PurchaseStorage>();
|
|
builder.Services.AddTransient<IClassStorage, ClassStorage>();
|
|
builder.Services.AddTransient<IPaymentStorage, PaymentStorage>();
|
|
|
|
builder.Services.AddLogging(option =>
|
|
{
|
|
var configuration = new ConfigurationBuilder()
|
|
.SetBasePath(Directory.GetCurrentDirectory())
|
|
.AddJsonFile(path: "appsettings.json", optional: false, reloadOnChange: true)
|
|
.Build();
|
|
|
|
var logger = new LoggerConfiguration()
|
|
.ReadFrom.Configuration(configuration)
|
|
.CreateLogger();
|
|
|
|
option.AddSerilog(logger);
|
|
});
|
|
|
|
var app = builder.Build();
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error");
|
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseStaticFiles();
|
|
|
|
app.UseRouting();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapRazorPages();
|
|
|
|
app.Run();
|