2024-04-11 12:41:44 +04:00
|
|
|
using AutoWorkshopBusinessLogic.BusinessLogics;
|
|
|
|
using AutoWorkshopContracts.BusinessLogicContracts;
|
2024-04-16 19:54:51 +04:00
|
|
|
using AutoWorkshopContracts.BusinessLogicsContracts;
|
2024-04-11 12:41:44 +04:00
|
|
|
using AutoWorkshopContracts.StoragesContracts;
|
|
|
|
using AutoWorkshopDatabaseImplement.Implements;
|
|
|
|
using Microsoft.OpenApi.Models;
|
|
|
|
|
2024-04-13 00:16:40 +04:00
|
|
|
var Builder = WebApplication.CreateBuilder(args);
|
|
|
|
Builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
|
|
|
Builder.Logging.AddLog4Net("log4net.config");
|
|
|
|
|
2024-04-11 12:41:44 +04:00
|
|
|
// Add services to the container.
|
2024-04-13 00:16:40 +04:00
|
|
|
Builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
|
|
|
Builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
|
|
|
Builder.Services.AddTransient<IRepairStorage, RepairStorage>();
|
2024-04-16 19:54:51 +04:00
|
|
|
Builder.Services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
|
|
|
|
2024-04-13 00:16:40 +04:00
|
|
|
Builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
|
|
|
Builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
|
|
|
Builder.Services.AddTransient<IRepairLogic, RepairLogic>();
|
2024-04-16 19:54:51 +04:00
|
|
|
Builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
|
|
|
|
2024-04-13 00:16:40 +04:00
|
|
|
Builder.Services.AddControllers();
|
2024-04-11 12:41:44 +04:00
|
|
|
|
2024-04-13 00:16:40 +04:00
|
|
|
Builder.Services.AddEndpointsApiExplorer();
|
|
|
|
Builder.Services.AddSwaggerGen(c =>
|
2024-04-11 12:41:44 +04:00
|
|
|
{
|
|
|
|
c.SwaggerDoc("v1", new OpenApiInfo
|
|
|
|
{
|
|
|
|
Title = "AutoWorkshopRestApi",
|
|
|
|
Version = "v1"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2024-04-13 00:16:40 +04:00
|
|
|
var App = Builder.Build();
|
|
|
|
|
|
|
|
if (App.Environment.IsDevelopment())
|
2024-04-11 12:41:44 +04:00
|
|
|
{
|
2024-04-13 00:16:40 +04:00
|
|
|
App.UseSwagger();
|
|
|
|
App.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json",
|
2024-04-11 12:41:44 +04:00
|
|
|
"AutoWorkshopRestApi v1"));
|
|
|
|
}
|
2024-04-13 00:16:40 +04:00
|
|
|
|
|
|
|
App.UseHttpsRedirection();
|
|
|
|
App.UseAuthorization();
|
|
|
|
App.MapControllers();
|
|
|
|
|
|
|
|
App.Run();
|