69 lines
2.6 KiB
C#
69 lines
2.6 KiB
C#
using HotelBusinessLogic.BusinessLogics;
|
|
using HotelBusinessLogic.MailWorker;
|
|
using HotelBusinessLogic.OfficePackage;
|
|
using HotelBusinessLogic.OfficePackage.Implements;
|
|
using HotelContracts.BindingModels;
|
|
using HotelContracts.BusinessLogicsContracts;
|
|
using HotelContracts.StoragesContracts;
|
|
using HotelDatabaseImplement.Implements;
|
|
using HotelView;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddControllersWithViews();
|
|
builder.Services.AddTransient<IMaitreStorage, MaitreStorage>();
|
|
builder.Services.AddTransient<IRoomStorage, RoomStorage>();
|
|
builder.Services.AddTransient<IGuestStorage, GuestStorage>();
|
|
builder.Services.AddTransient<IReservationStorage, ReservationStorage>();
|
|
builder.Services.AddTransient<ICleaningInstrumentsStorage, CleaningInstrumentsStorage>();
|
|
builder.Services.AddTransient<ICleaningStorage, CleaningStorage>();
|
|
|
|
builder.Services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
|
builder.Services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
|
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
|
|
|
builder.Services.AddTransient<IReportLogic, ReportLogic>();
|
|
builder.Services.AddTransient<ICleaningLogic, CleaningLogic>();
|
|
builder.Services.AddTransient<ICleaningInstrumentsLogic, CleaningInstrumentsLogic>();
|
|
builder.Services.AddTransient<IReservationLogic, ReservationLogic>();
|
|
builder.Services.AddTransient<IGuestLogic, GuestLogic>();
|
|
builder.Services.AddTransient<IRoomLogic, RoomLogic>();
|
|
builder.Services.AddTransient<IMaitreLogic, MaitreLogic>();
|
|
|
|
builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
|
builder.Services.AddSingleton<Api>();
|
|
|
|
var app = builder.Build();
|
|
var mailSender = app.Services.GetService<AbstractMailWorker>();
|
|
mailSender?.MailConfig(new MailConfigBindingModel
|
|
{
|
|
MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value ?? string.Empty,
|
|
MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value ?? string.Empty,
|
|
SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value ?? string.Empty,
|
|
SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value),
|
|
PopHost = builder.Configuration?.GetSection("PopHost")?.Value ?? string.Empty,
|
|
PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value)
|
|
});
|
|
|
|
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Home/Error");
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseStaticFiles();
|
|
|
|
app.UseRouting();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllerRoute(
|
|
name: "default",
|
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
|
|
|
app.Run();
|