CourseWorkElectronicsShop/ElectronicsShop/ElectronicsShopRestAPI/Program.cs
Илья Федотов 4ab0533d8b fix
2024-05-27 18:06:34 +04:00

42 lines
1.3 KiB
C#

using ElectronicsShopBusinessLogic.BusinessLogic;
using ElectronicsShopContracts.BusinessLogicContracts;
using ElectronicsShopContracts.StorageContracts;
using ElectronicsShopDataBaseImplement.Implements;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
//todo logger!!!
// Add services to the container.
builder.Services.AddTransient<IClientStorage, ClientStorage>();
builder.Services.AddTransient<IEmployeeStorage, EmployeeStorage>();
builder.Services.AddTransient<IProductStorage, ProductStorage>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IEmployeeLogic, EmployeeLogic>();
builder.Services.AddTransient<IProductLogic, ProductLogic>();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(x => x.SwaggerDoc("v1", new OpenApiInfo { Title = "ElectronicsShopRestAPI", Version = "v1" }));
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(x => x.SwaggerEndpoint("/swagger/v1/swagger.json", "ElectronicsShopRestAPI v1"));
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();