PIbd-21_Pyatakov_KM_Markov_.../UniversityRestAPI/Program.cs

58 lines
2.2 KiB
C#
Raw Normal View History

using CarDealershipBusinessLogic.BusinessLogic.OfficePackage;
using Microsoft.OpenApi.Models;
using System.Reflection.PortableExecutable;
using UniversityBusinessLogic.BusinessLogics;
using UniversityBusinessLogic.OfficePackage;
using UniversityContracts.BusinessLogicContracts;
using UniversityContracts.StoragesContracts;
using UniversityDataBaseImplemet.Implements;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddTransient<IUserStorage, UserStorage>();
2023-05-17 16:47:38 +04:00
builder.Services.AddTransient<IStudentStorage, StudentStorage>();
builder.Services.AddTransient<IEducationStatusStorage, EducationStatusStorage>();
builder.Services.AddTransient<IDocumentStorage, DocumentStorage>();
builder.Services.AddTransient<IEducationGroupStorage, EducationGroupStorage>();
builder.Services.AddTransient<IDisciplineStorage, DisciplineStorage>();
builder.Services.AddTransient<IStreamStorage, StreamStorage>();
builder.Services.AddTransient<IUserLogic, UserLogic>();
2023-05-17 16:47:38 +04:00
builder.Services.AddTransient<IStudentLogic, StudentLogic>();
builder.Services.AddTransient<IEducationStatusLogic, EducationStatusLogic>();
builder.Services.AddTransient<IDocumentLogic, DocumentLogic>();
builder.Services.AddTransient<IEducationGroupLogic, EducationGroupLogic>();
builder.Services.AddTransient<IDisciplineLogic, DisciplineLogic>();
builder.Services.AddTransient<IStreamLogic, StreamLogic>();
builder.Services.AddTransient<IReportProviderLogic, ReportProviderLogic>();
builder.Services.AddTransient<WordBuilderProvider>();
builder.Services.AddTransient<ExcelBuilderProvider>();
builder.Services.AddTransient<PdfBuilderProvider>();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "UniversityRestApi", Version = "v1" });
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "UniversityRestApi"));
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();