2024-04-27 21:33:32 +04:00
|
|
|
using ComputerShopBusinessLogic.BusinessLogics;
|
|
|
|
using ComputerShopContracts.BusinessLogicContracts;
|
|
|
|
using ComputerShopContracts.StorageContracts;
|
|
|
|
using ComputerShopDatabaseImplement.Implements;
|
|
|
|
using Microsoft.OpenApi.Models;
|
|
|
|
|
2024-04-17 17:21:58 +04:00
|
|
|
var Builder = WebApplication.CreateBuilder(args);
|
2024-04-27 21:33:32 +04:00
|
|
|
Builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
|
|
|
Builder.Logging.AddLog4Net("log4net.config");
|
|
|
|
|
|
|
|
|
|
|
|
Builder.Services.AddTransient<IUserStorage, UserStorage>();
|
|
|
|
Builder.Services.AddTransient<IShipmentStorage, ShipmentStorage>();
|
|
|
|
Builder.Services.AddTransient<IRequestStorage, RequestStorage>();
|
|
|
|
Builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
|
|
|
|
|
|
|
|
|
|
|
Builder.Services.AddTransient<IUserLogic, UserLogic>();
|
|
|
|
Builder.Services.AddTransient<IShipmentLogic, ShipmentLogic>();
|
|
|
|
Builder.Services.AddTransient<IRequestLogic, RequestLogic>();
|
|
|
|
Builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
|
|
|
|
2024-04-17 17:21:58 +04:00
|
|
|
|
|
|
|
Builder.Services.AddControllers();
|
|
|
|
Builder.Services.AddEndpointsApiExplorer();
|
2024-04-27 21:33:32 +04:00
|
|
|
Builder.Services.AddSwaggerGen(c =>
|
|
|
|
{
|
|
|
|
c.SwaggerDoc("v1", new OpenApiInfo
|
|
|
|
{
|
|
|
|
Title = "ComputerShopRestApi",
|
|
|
|
Version = "v1"
|
|
|
|
});
|
|
|
|
});
|
2024-04-17 17:21:58 +04:00
|
|
|
|
|
|
|
var App = Builder.Build();
|
|
|
|
|
|
|
|
if (App.Environment.IsDevelopment())
|
|
|
|
{
|
|
|
|
App.UseSwagger();
|
2024-04-27 21:33:32 +04:00
|
|
|
App.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "ComputerShopRestApi v1"));
|
2024-04-17 17:21:58 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
App.UseHttpsRedirection();
|
|
|
|
App.UseAuthorization();
|
|
|
|
App.MapControllers();
|
|
|
|
|
|
|
|
App.Run();
|