This commit is contained in:
kagbie3nn@mail.ru 2024-04-28 16:09:39 +04:00
parent 5de892cbff
commit 121b3bc3c5
8 changed files with 140 additions and 2 deletions

View File

@ -9,9 +9,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZooContracts", "ZooContract
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZooDataModels", "ZooDataModels\ZooDataModels.csproj", "{FBA80C4B-D1A0-42D4-A90B-123323E06314}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZooDataBaseImplement", "ZooDataBaseImplement\ZooDataBaseImplement.csproj", "{599C34A0-51C7-4782-9F9C-F2EFCC02FFA2}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZooDataBaseImplement", "ZooDataBaseImplement\ZooDataBaseImplement.csproj", "{599C34A0-51C7-4782-9F9C-F2EFCC02FFA2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZooBusinessLogic", "ZooBusinessLogic\ZooBusinessLogic.csproj", "{CE5F683C-D19D-43FD-A0DA-0E66BD228996}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZooBusinessLogic", "ZooBusinessLogic\ZooBusinessLogic.csproj", "{CE5F683C-D19D-43FD-A0DA-0E66BD228996}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZooRestApi", "ZooRestApi\ZooRestApi.csproj", "{B0BDE512-C050-42B1-8167-E07E2DD867DB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -39,6 +41,10 @@ Global
{CE5F683C-D19D-43FD-A0DA-0E66BD228996}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE5F683C-D19D-43FD-A0DA-0E66BD228996}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE5F683C-D19D-43FD-A0DA-0E66BD228996}.Release|Any CPU.Build.0 = Release|Any CPU
{B0BDE512-C050-42B1-8167-E07E2DD867DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0BDE512-C050-42B1-8167-E07E2DD867DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0BDE512-C050-42B1-8167-E07E2DD867DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0BDE512-C050-42B1-8167-E07E2DD867DB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,33 @@
using Microsoft.AspNetCore.Mvc;
namespace ZooRestApi.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();
}
}
}

View File

@ -0,0 +1,25 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();

View File

@ -0,0 +1,31 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:15421",
"sslPort": 44309
}
},
"profiles": {
"ZooRestApi": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7269;http://localhost:5244",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,13 @@
namespace ZooRestApi
{
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; }
}
}

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}