2024-05-28 18:32:51 +04:00
|
|
|
using TravelAgencyBusinessLogic.BusinessLogics;
|
2024-05-29 08:46:50 +04:00
|
|
|
using TravelAgencyBusinessLogic.OfficePackage.Implements;
|
|
|
|
using TravelAgencyBusinessLogic.OfficePackage;
|
2024-05-28 18:32:51 +04:00
|
|
|
using TravelAgencyContracts.BusinessLogicsContracts;
|
|
|
|
using TravelAgencyContracts.StoragesContracts;
|
|
|
|
using TravelAgencyDatabaseImplement.Implements;
|
2024-05-29 08:46:50 +04:00
|
|
|
using TravelAgencyWebApp;
|
|
|
|
using TravelAgencyBusinessLogic.MailWorker;
|
2024-05-28 18:32:51 +04:00
|
|
|
|
2024-05-30 03:40:26 +04:00
|
|
|
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
|
|
|
|
|
2024-04-30 18:42:41 +04:00
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddControllersWithViews();
|
2024-05-28 18:32:51 +04:00
|
|
|
|
|
|
|
builder.Services.AddTransient<IUserStorage, UserStorage>();
|
|
|
|
builder.Services.AddTransient<ITourStorage, TourStorage>();
|
|
|
|
builder.Services.AddTransient<IExcursionStorage, ExcursionStorage>();
|
|
|
|
builder.Services.AddTransient<IExcursionGroupStorage, ExcursionGroupStorage>();
|
|
|
|
builder.Services.AddTransient<IGuideStorage, GuideStorage>();
|
|
|
|
builder.Services.AddTransient<IPlaceStorage, PlaceStorage>();
|
|
|
|
builder.Services.AddTransient<ITripStorage, TripStorage>();
|
|
|
|
|
|
|
|
builder.Services.AddTransient<IUserLogic, UserLogic>();
|
|
|
|
builder.Services.AddTransient<ITourLogic, TourLogic>();
|
|
|
|
builder.Services.AddTransient<IExcursionLogic, ExcursionLogic>();
|
|
|
|
builder.Services.AddTransient<IExcursionGroupLogic, ExcursionGroupLogic>();
|
|
|
|
builder.Services.AddTransient<IGuideLogic, GuideLogic>();
|
|
|
|
builder.Services.AddTransient<IPlaceLogic, PlaceLogic>();
|
|
|
|
builder.Services.AddTransient<ITripLogic, TripLogic>();
|
|
|
|
|
2024-05-29 08:46:50 +04:00
|
|
|
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>();
|
|
|
|
|
2024-04-30 18:42:41 +04:00
|
|
|
var app = builder.Build();
|
2024-05-28 18:32:51 +04:00
|
|
|
|
2024-05-29 08:46:50 +04:00
|
|
|
var mailSender = app.Services.GetService<AbstractMailWorker>();
|
|
|
|
mailSender?.MailConfig(new()
|
|
|
|
{
|
|
|
|
MailLogin = builder.Configuration?.GetSection("MailLogin")?.Value?.ToString() ?? string.Empty,
|
|
|
|
MailPassword = builder.Configuration?.GetSection("MailPassword")?.Value?.ToString() ?? string.Empty,
|
|
|
|
SmtpClientHost = builder.Configuration?.GetSection("SmtpClientHost")?.Value?.ToString() ?? string.Empty,
|
|
|
|
SmtpClientPort = Convert.ToInt32(builder.Configuration?.GetSection("SmtpClientPort")?.Value?.ToString()),
|
|
|
|
PopHost = builder.Configuration?.GetSection("PopHost")?.Value?.ToString() ?? string.Empty,
|
|
|
|
PopPort = Convert.ToInt32(builder.Configuration?.GetSection("PopPort")?.Value?.ToString())
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
var guideLogic = app.Services.GetService<IGuideLogic>();
|
|
|
|
var tripLogic = app.Services.GetService<ITripLogic>();
|
|
|
|
var placeLogic = app.Services.GetService<IPlaceLogic>();
|
|
|
|
|
|
|
|
var seeder = new SeedingService(guideLogic, tripLogic, placeLogic);
|
|
|
|
seeder.SeedGuarantor();
|
|
|
|
|
2024-04-30 18:42:41 +04:00
|
|
|
// 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();
|