46 lines
1.6 KiB
C#
46 lines
1.6 KiB
C#
using Microsoft.OpenApi.Models;
|
|
using UniversityBusinessLogic.BusinessLogics;
|
|
using UniversityContracts.BusinessLogicContracts;
|
|
using UniversityContracts.StoragesContracts;
|
|
using UniversityDataBaseImplemet.Implements;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddTransient<IUserStorage, UserStorage>();
|
|
builder.Services.AddTransient<IStudentStorage, StudentStorage>();
|
|
builder.Services.AddTransient<IEducationStatusStorage, EducationStatusStorage>();
|
|
builder.Services.AddTransient<IDocumentStorage, DocumentStorage>();
|
|
builder.Services.AddTransient<IEducationGroupStorage, EducationGroupStorage>();
|
|
|
|
builder.Services.AddTransient<IUserLogic, UserLogic>();
|
|
builder.Services.AddTransient<IStudentLogic, StudentLogic>();
|
|
builder.Services.AddTransient<IEducationStatusLogic, EducationStatusLogic>();
|
|
builder.Services.AddTransient<IDocumentLogic, DocumentLogic>();
|
|
builder.Services.AddTransient<IEducationGroupLogic, EducationGroupLogic>();
|
|
|
|
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(); |