Coursework_ComputerStore_Li.../ComputerStoreRestAPI/Program.cs

52 lines
1.9 KiB
C#
Raw Normal View History

using ComputerStoreBusinessLogic.BusinessLogic;
using ComputerStoreContracts.BusinessLogicContracts;
using ComputerStoreContracts.StorageContracts;
using ComputerStoreDatabaseImplement.Implements;
var builder = WebApplication.CreateBuilder(args);
builder.Logging.SetMinimumLevel(LogLevel.Trace);
builder.Logging.AddLog4Net("log4net.config");
// Add services to the container.
builder.Services.AddTransient<IEmployeeStorage,EmployeeStorage>();
builder.Services.AddTransient<IComponentStorage, ComponentStorage>();
builder.Services.AddTransient<IPCStorage,PCStorage>();
builder.Services.AddTransient<IProductStorage, ProductStorage>();
2023-05-17 17:57:25 +04:00
builder.Services.AddTransient<IConsignmentStorage, ConsignmentStorage>();
builder.Services.AddTransient<IRequestComponentStorage, RequestComponentStorage>();
builder.Services.AddTransient<IRequestStorage, RequestStorage>();
builder.Services.AddTransient<IEmployeeLogic,EmployeeLogic>();
builder.Services.AddTransient<IComponentLogic, ComponentLogic>();
builder.Services.AddTransient<IEmployeeReportLogic, EmployeeReportLogic>();
builder.Services.AddTransient<IPCLogic, PCLogic>();
builder.Services.AddTransient<IProductLogic, ProductLogic>();
2023-05-17 17:57:25 +04:00
builder.Services.AddTransient<IConsignmentLogic,ConsignmentLogic>();
builder.Services.AddTransient<IRequestComponentLogic, RequestComponentLogic>();
builder.Services.AddTransient<IRequestLogic, RequestLogic>();
builder.Services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();