PIbd-22_Chernyshev_Shabunov.../ComputerShopImplementerApp/Program.cs
2024-05-29 19:01:27 +04:00

60 lines
2.0 KiB
C#

using ComputerShopBusinessLogic.BusinessLogics;
using ComputerShopContracts.BusinessLogicContracts;
using ComputerShopContracts.StorageContracts;
using ComputerShopDatabaseImplement.Implements;
using ComputerShopDatabaseImplement.Models;
using ComputerShopDataModels.Models;
using ComputerShopImplementerApp;
using ComputerShopBusinessLogic.OfficePackage;
using ComputerShopBusinessLogic.OfficePackage.Implements;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddTransient<IUserStorage, UserStorage>();
builder.Services.AddTransient<IShipmentStorage, ShipmentStorage>();
builder.Services.AddTransient<IRequestStorage, RequestStorage>();
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
builder.Services.AddTransient<IUserLogic, UserLogic>();
builder.Services.AddTransient<IShipmentLogic, ShipmentLogic>();
builder.Services.AddTransient<IRequestLogic, RequestLogic>();
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
builder.Services.AddTransient<IAssemblyStorage, AssemblyStorage>();
builder.Services.AddTransient<IReportImplementerLogic, ReportImplementerLogic>();
builder.Services.AddTransient<AbstractSaveToWordImplementer, SaveToWordImplementer>();
builder.Services.AddTransient<AbstractSaveToExcelImplementer, SaveToExcelImplementer>();
builder.Services.AddTransient<AbstractSaveToPdfImplementer, SaveToPdfImplementer>();
// Add services to the container.
builder.Services.AddControllersWithViews();
var app = builder.Build();
APIUser.Connect(builder.Configuration);
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();