52 lines
1.7 KiB
C#
52 lines
1.7 KiB
C#
using Microsoft.OpenApi.Models;
|
|
using AutoCenterBusinessLogic.BusinessLogics;
|
|
using AutoCenterContracts.BusinessLogicsContracts;
|
|
using AutoCenterContracts.StoragesContracts;
|
|
using AutoCenterDatabaseImplement.Implements;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
|
builder.Logging.AddLog4Net("log4net.config");
|
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddTransient<ICarStorage, CarStorage>();
|
|
builder.Services.AddTransient<IEquipmentStorage, EquipmentStorage>();
|
|
builder.Services.AddTransient<IPresellingWorkStorage, PresellingWorkStorage>();
|
|
builder.Services.AddTransient<IPurchaseStorage, PurchaseStorage>();
|
|
builder.Services.AddTransient<IUserStorage, UserStorage>();
|
|
builder.Services.AddTransient<IWishStorage, WishStorage>();
|
|
|
|
builder.Services.AddTransient<ICarLogic, CarLogic>();
|
|
builder.Services.AddTransient<IEquipmentLogic, EquipmentLogic>();
|
|
builder.Services.AddTransient<IPresellingWorkLogic, PresellingWorkLogic>();
|
|
builder.Services.AddTransient<IPurchaseLogic, PurchaseLogic>();
|
|
builder.Services.AddTransient<IUserLogic, UserLogic>();
|
|
builder.Services.AddTransient<IWishLogic, WishLogic>();
|
|
|
|
builder.Services.AddControllers();
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
|
|
builder.Services.AddSwaggerGen(c =>
|
|
{
|
|
c.SwaggerDoc("v1", new OpenApiInfo { Title = "AutoCenterRestApi", Version = "v1" });
|
|
});
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AutoCenterRestApi v1"));
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run();
|