SUBD_PIbd-23_ZakharovRA/CarShowroom/CarShowroomRestApi/Program.cs
2024-05-06 11:31:59 +04:00

47 lines
1.8 KiB
C#

using CarShowroomBusinessLogic.BusinessLogic;
using CarShowroomContracts.BusinessLogic;
using CarShowroomContracts.StorageContracts;
using CarShowroomDatabaseStorage.Storages;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.SetMinimumLevel(LogLevel.Trace);
// Add services to the container.
builder.Services.AddTransient<IClientStorage, ClientStorage>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IEmployeeStorage, EmployeeStorage>();
builder.Services.AddTransient<IEmployeeLogic, EmployeeLogic>();
builder.Services.AddTransient<IMakeStorage, MakeStorage>();
builder.Services.AddTransient<IMakeLogic, MakeLogic>();
builder.Services.AddTransient<IModelStorage, ModelStorage>();
builder.Services.AddTransient<IModelLogic, ModelLogic>();
builder.Services.AddTransient<ICarStorage, CarStorage>();
builder.Services.AddTransient<ICarLogic, CarLogic>();
builder.Services.AddTransient<ISaleStorage, SaleStorage>();
builder.Services.AddTransient<ISaleLogic, SaleLogic>();
builder.Services.AddTransient<IServiceStorage, ServiceStorage>();
builder.Services.AddTransient<IServiceLogic, ServiceLogic>();
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 = "CarShowroomRestApi",
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",
"CarShowroomRestApi v1"));
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();