57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using Microsoft.OpenApi.Models;
|
|
using AutoCenterBusinessLogic.BusinessLogics;
|
|
using AutoCenterContracts.BusinessLogicsContracts;
|
|
using AutoCenterContracts.StoragesContracts;
|
|
using AutoCenterDatabaseImplement.Implements;
|
|
using AutoCenterBusinessLogic.OfficePackage;
|
|
using AutoCenterBusinessLogic.OfficePackage.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.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
|
builder.Services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
|
builder.Services.AddTransient<IReportLogic, ReportLogic>();
|
|
|
|
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();
|