Changed models, added Application layer models

This commit is contained in:
2024-08-15 14:54:23 +03:00
parent 1d8405b4ec
commit c1a4acf414
50 changed files with 628 additions and 647 deletions

View File

@@ -1,31 +1,30 @@
using System.Reflection;
using Infrastructure;
namespace SchengenVisaApi
namespace SchengenVisaApi;
/// Provides methods to add services to DI-container
public static class DependencyInjection
{
/// Provides methods to add services to DI-container
public static class DependencyInjection
/// Add needed services
public static IServiceCollection RegisterServices(this IServiceCollection services)
{
/// Add needed services
public static IServiceCollection RegisterServices(this IServiceCollection services)
{
services
.AddInfrastructure()
.AddPresentation();
services
.AddInfrastructure()
.AddPresentation();
return services;
}
/// Add services needed for Presentation layer
private static void AddPresentation(this IServiceCollection services)
{
services.AddControllers();
services.AddEndpointsApiExplorer();
services.AddSwaggerGen(options =>
{
var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
});
}
return services;
}
}
/// Add services needed for Presentation layer
private static void AddPresentation(this IServiceCollection services)
{
services.AddControllers();
services.AddEndpointsApiExplorer();
services.AddSwaggerGen(options =>
{
var xmlFilename = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
});
}
}

View File

@@ -1,5 +1,4 @@
namespace SchengenVisaApi;
#pragma warning disable CS1591
public class Program
{
@@ -14,4 +13,4 @@ public class Program
app.Run();
}
}
#pragma warning restore CS1591
#pragma warning restore CS1591

View File

@@ -1,19 +1,18 @@
namespace SchengenVisaApi
namespace SchengenVisaApi;
/// Provides methods for configuring middleware
public static class PipelineRequest
{
/// Provides methods for configuring middleware
public static class PipelineRequest
/// Configure middleware
public static WebApplication ConfigurePipelineRequest(this WebApplication app)
{
/// Configure middleware
public static WebApplication ConfigurePipelineRequest(this WebApplication app)
{
app.UseSwagger()
.UseSwaggerUI();
app.UseSwagger()
.UseSwaggerUI();
app.UseHttpsRedirection();
app.UseHttpsRedirection();
app.MapControllers();
app.MapControllers();
return app;
}
return app;
}
}
}