72 lines
2.5 KiB
C#
72 lines
2.5 KiB
C#
using VeterinaryClinicBusinessLogics.BusinessLogics;
|
|
using VeterinaryClinicBusinessLogics.OfficePackage.Implements;
|
|
using VeterinaryClinicBusinessLogics.OfficePackage;
|
|
using VeterinaryClinicContracts.BusinessLogicsContracts;
|
|
using VeterinaryClinicContracts.StoragesContracts;
|
|
using VeterinaryClinicDatabaseImplement.Implements;
|
|
using VeterinaryClinicWebApp;
|
|
using VeterinaryClinicBusinessLogics.MailWorker;
|
|
using System.Text;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Ðåãèñòðàöèÿ ïîñòàâùèêà êîäèðîâîê
|
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddControllersWithViews();
|
|
|
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
|
|
|
builder.Services.AddTransient<IAnimalStorage, AnimalStorage>();
|
|
builder.Services.AddTransient<IMedicationStorage, MedicationStorage>();
|
|
builder.Services.AddTransient<IServiceStorage, ServiceStorage>();
|
|
builder.Services.AddTransient<IUserStorage, UserStorage>();
|
|
builder.Services.AddTransient<IVaccinationStorage, VaccinationStorage>();
|
|
builder.Services.AddTransient<IVisitStorage, VisitStorage>();
|
|
|
|
builder.Services.AddTransient<IAnimalLogic, AnimalLogic>();
|
|
builder.Services.AddTransient<IMedicationLogic, MedicationLogic>();
|
|
builder.Services.AddTransient<IServiceLogic, ServiceLogic>();
|
|
builder.Services.AddTransient<IUserLogic, UserLogic>();
|
|
builder.Services.AddTransient<IVaccinationLogic, VaccinationLogic>();
|
|
builder.Services.AddTransient<IVisitLogic, VisitLogic>();
|
|
|
|
builder.Services.AddTransient<IReportLogic, ReportLogic>();
|
|
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
|
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
|
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
|
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
|
|
|
builder.Services.AddSession(options =>
|
|
{
|
|
options.IdleTimeout = TimeSpan.FromMinutes(30);
|
|
options.Cookie.HttpOnly = true;
|
|
options.Cookie.IsEssential = true;
|
|
});
|
|
|
|
var app = builder.Build();
|
|
|
|
APIClient.Connect(builder.Configuration);
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Home/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.MapControllerRoute(
|
|
name: "default",
|
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
|
|
|
app.Run();
|