CourseWorkElectronicsShop/ElectronicsShop/ElectronicsShopRestAPI/Program.cs
Илья Федотов 1a5a000ef4 CostItem create
2024-05-27 22:05:47 +04:00

46 lines
1.6 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<IOrderStorage, OrderStorage>();
builder.Services.AddTransient<ICostItemStorage, CostItemStorage>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IEmployeeLogic, EmployeeLogic>();
builder.Services.AddTransient<IProductLogic, ProductLogic>();
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
builder.Services.AddTransient<ICostItemLogic, CostItemLogic>();
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();