Добавлен RESTAPI проект
This commit is contained in:
parent
59b2514874
commit
3c2a383103
@ -17,6 +17,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecuritySystemFileImplement
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecuritySystemDatabaseImplement", "SecuritySystemDatabaseImplement\SecuritySystemDatabaseImplement.csproj", "{4AE7461C-39CC-463B-B5A1-A47ED3B9E925}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecuritySystemRestApi", "SecuritySystemRestApi\SecuritySystemRestApi.csproj", "{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -111,6 +113,18 @@ Global
|
||||
{4AE7461C-39CC-463B-B5A1-A47ED3B9E925}.Release|x64.Build.0 = Release|x64
|
||||
{4AE7461C-39CC-463B-B5A1-A47ED3B9E925}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{4AE7461C-39CC-463B-B5A1-A47ED3B9E925}.Release|x86.Build.0 = Release|Any CPU
|
||||
{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}.Release|x64.Build.0 = Release|Any CPU
|
||||
{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{A45C62CE-D0FF-4347-A6FF-773A6563BDA9}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -0,0 +1,33 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace SecuritySystemRestApi.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetWeatherForecast")]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateTime.Now.AddDays(index),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
41
SecuritySystem/SecuritySystemRestApi/Program.cs
Normal file
41
SecuritySystem/SecuritySystemRestApi/Program.cs
Normal file
@ -0,0 +1,41 @@
|
||||
using SecuritySystemBusinessLogic.BusinessLogics;
|
||||
using SecuritySystemContracts.BusinessLogicsContracts;
|
||||
using SecuritySystemContracts.StoragesContracts;
|
||||
using SecuritySystemDatabaseImplement.Implements;
|
||||
using Microsoft.OpenApi.Models;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
||||
builder.Logging.AddLog4Net("log4net.config");
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
||||
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
||||
builder.Services.AddTransient<ISecureStorage, SecureStorage>();
|
||||
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||
builder.Services.AddTransient<ISecureLogic, SecureLogic>();
|
||||
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 = "SecuritySystemRestApi",
|
||||
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", "SecuritySystemRestApi v1"));
|
||||
}
|
||||
app.UseHttpsRedirection();
|
||||
app.UseAuthorization();
|
||||
app.MapControllers();
|
||||
app.Run();
|
@ -0,0 +1,31 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:38474",
|
||||
"sslPort": 44377
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"SecuritySystemRestApi": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7129;http://localhost:5257",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SecuritySystemBusinessLogic\SecuritySystemBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\SecuritySystemDatabaseImplement\SecuritySystemDatabaseImplement.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
13
SecuritySystem/SecuritySystemRestApi/WeatherForecast.cs
Normal file
13
SecuritySystem/SecuritySystemRestApi/WeatherForecast.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace SecuritySystemRestApi
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
9
SecuritySystem/SecuritySystemRestApi/appsettings.json
Normal file
9
SecuritySystem/SecuritySystemRestApi/appsettings.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user