CourseWorkElectronicsShop/ElectronicsShop/ElectronicsShopRestAPI/Program.cs

46 lines
1.6 KiB
C#
Raw Permalink Normal View History

2024-05-27 14:57:41 +04:00
using ElectronicsShopBusinessLogic.BusinessLogic;
using ElectronicsShopContracts.BusinessLogicContracts;
using ElectronicsShopContracts.StorageContracts;
using ElectronicsShopDataBaseImplement.Implements;
2024-04-29 21:57:01 +04:00
using Microsoft.OpenApi.Models;
2024-04-29 21:38:18 +04:00
var builder = WebApplication.CreateBuilder(args);
//todo logger!!!
2024-04-29 21:38:18 +04:00
// Add services to the container.
2024-05-27 14:57:41 +04:00
builder.Services.AddTransient<IClientStorage, ClientStorage>();
2024-05-27 17:35:14 +04:00
builder.Services.AddTransient<IEmployeeStorage, EmployeeStorage>();
2024-05-27 18:06:34 +04:00
builder.Services.AddTransient<IProductStorage, ProductStorage>();
2024-05-27 18:36:13 +04:00
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
2024-05-27 22:05:47 +04:00
builder.Services.AddTransient<ICostItemStorage, CostItemStorage>();
2024-05-27 14:57:41 +04:00
builder.Services.AddTransient<IClientLogic, ClientLogic>();
2024-05-27 17:35:14 +04:00
builder.Services.AddTransient<IEmployeeLogic, EmployeeLogic>();
2024-05-27 18:06:34 +04:00
builder.Services.AddTransient<IProductLogic, ProductLogic>();
2024-05-27 18:36:13 +04:00
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
2024-05-27 22:05:47 +04:00
builder.Services.AddTransient<ICostItemLogic, CostItemLogic>();
2024-05-27 14:57:41 +04:00
2024-04-29 21:38:18 +04:00
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" }));
2024-04-29 21:38:18 +04:00
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"));
2024-04-29 21:38:18 +04:00
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();