2023-05-14 17:51:51 +04:00
|
|
|
using HotelBusinessLogic.BusinessLogics;
|
2023-04-06 17:48:20 +04:00
|
|
|
using HotelContracts.BusinessLogicsContracts;
|
|
|
|
using HotelContracts.StoragesContracts;
|
|
|
|
using HotelDataBaseImplement.Implemets;
|
2023-04-06 17:19:43 +04:00
|
|
|
using Microsoft.OpenApi.Models;
|
2023-05-14 17:51:51 +04:00
|
|
|
//using HotelBusinessLogic.MailWorker;
|
|
|
|
using HotelContracts.BindingModels;
|
2023-04-06 17:19:43 +04:00
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
|
|
|
builder.Logging.AddLog4Net("log4net.config");
|
|
|
|
|
2023-05-14 17:51:51 +04:00
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddTransient<IOrganiserStorage, OrganiserStorage>();
|
|
|
|
builder.Services.AddTransient<IMealPlanStorage, MealPlanStorage>();
|
|
|
|
builder.Services.AddTransient<IMemberStorage, MemberStorage>();
|
|
|
|
builder.Services.AddTransient<IConferenceStorage, ConferenceStorage>();
|
2023-04-06 17:19:43 +04:00
|
|
|
|
2023-05-14 17:51:51 +04:00
|
|
|
builder.Services.AddTransient<IOrganiserLogic, OrganiserLogic>();
|
|
|
|
builder.Services.AddTransient<IMealPlanLogic, MealPlanLogic>();
|
|
|
|
builder.Services.AddTransient<IMemberLogic, MemberLogic>();
|
|
|
|
builder.Services.AddTransient<IConferenceLogic, ConferenceLogic>();
|
2023-04-06 17:48:20 +04:00
|
|
|
|
2023-05-16 00:09:17 +04:00
|
|
|
builder.Services.AddTransient<IHeadwaiterStorage, HeadwaiterStorage>();
|
|
|
|
builder.Services.AddTransient<IDinnerStorage, DinnerStorage>();
|
|
|
|
builder.Services.AddTransient<IRoomStorage, RoomStorage>();
|
|
|
|
builder.Services.AddTransient<IConferenceBookingStorage, ConferenceBookingStorage>();
|
|
|
|
|
|
|
|
builder.Services.AddTransient<IHeadwaiterLogic, HeadwaiterLogic>();
|
|
|
|
builder.Services.AddTransient<IDinnerLogic, DinnerLogic>();
|
|
|
|
builder.Services.AddTransient<IRoomLogic, RoomLogic>();
|
|
|
|
builder.Services.AddTransient<IConferenceBookingLogic, ConferenceBookingLogic>();
|
|
|
|
|
2023-05-14 17:51:51 +04:00
|
|
|
//builder.Services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
|
|
|
|
|
|
|
builder.Services.AddControllers();
|
|
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
2023-04-06 17:19:43 +04:00
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
|
|
builder.Services.AddSwaggerGen(c =>
|
|
|
|
{
|
|
|
|
c.SwaggerDoc("v1", new OpenApiInfo
|
|
|
|
{
|
2023-05-14 17:51:51 +04:00
|
|
|
Title = "HotelRestApi",
|
2023-04-06 17:19:43 +04:00
|
|
|
Version = "v1"
|
|
|
|
});
|
|
|
|
});
|
2023-05-14 17:51:51 +04:00
|
|
|
|
2023-04-06 17:19:43 +04:00
|
|
|
var app = builder.Build();
|
2023-05-14 17:51:51 +04:00
|
|
|
|
|
|
|
//var mailSender = app.Services.GetService<AbstractMailWorker>();
|
|
|
|
|
|
|
|
//mailSender?.MailConfig(new MailConfigBindingModel
|
|
|
|
//{
|
|
|
|
// 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())
|
|
|
|
//});
|
|
|
|
|
|
|
|
// Configure the HTTP request pipeline.
|
2023-04-06 17:19:43 +04:00
|
|
|
if (app.Environment.IsDevelopment())
|
|
|
|
{
|
|
|
|
app.UseSwagger();
|
2023-05-14 17:51:51 +04:00
|
|
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "HotelRestApi v1"));
|
2023-04-06 17:19:43 +04:00
|
|
|
}
|
2023-05-14 17:51:51 +04:00
|
|
|
|
2023-04-06 17:19:43 +04:00
|
|
|
app.UseHttpsRedirection();
|
2023-05-14 17:51:51 +04:00
|
|
|
|
2023-04-06 17:19:43 +04:00
|
|
|
app.UseAuthorization();
|
2023-05-14 17:51:51 +04:00
|
|
|
|
2023-04-06 17:19:43 +04:00
|
|
|
app.MapControllers();
|
2023-05-14 17:51:51 +04:00
|
|
|
|
|
|
|
app.Run();
|