From 972b6517e05aefb7bece2759aaf3d5f05fe63f21 Mon Sep 17 00:00:00 2001 From: Anastasia Date: Mon, 3 Apr 2023 20:12:58 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Hospital/Hospital.sln | 25 ++++++++++++++ .../Controllers/WeatherForecastController.cs | 33 +++++++++++++++++++ Hospital/Hospital/Hospital.csproj | 13 ++++++++ Hospital/Hospital/Program.cs | 25 ++++++++++++++ .../Hospital/Properties/launchSettings.json | 31 +++++++++++++++++ .../Hospital/appsettings.Development.json | 8 +++++ Hospital/Hospital/appsettings.json | 9 +++++ 7 files changed, 144 insertions(+) create mode 100644 Hospital/Hospital.sln create mode 100644 Hospital/Hospital/Controllers/WeatherForecastController.cs create mode 100644 Hospital/Hospital/Hospital.csproj create mode 100644 Hospital/Hospital/Program.cs create mode 100644 Hospital/Hospital/Properties/launchSettings.json create mode 100644 Hospital/Hospital/appsettings.Development.json create mode 100644 Hospital/Hospital/appsettings.json diff --git a/Hospital/Hospital.sln b/Hospital/Hospital.sln new file mode 100644 index 0000000..690b598 --- /dev/null +++ b/Hospital/Hospital.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32819.101 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hospital", "Hospital\Hospital.csproj", "{AFB79BC5-47CC-4DC9-B090-2190ECC6165E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AFB79BC5-47CC-4DC9-B090-2190ECC6165E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AFB79BC5-47CC-4DC9-B090-2190ECC6165E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AFB79BC5-47CC-4DC9-B090-2190ECC6165E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AFB79BC5-47CC-4DC9-B090-2190ECC6165E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {10D52A8F-A93F-4B95-8944-3690FFD8508E} + EndGlobalSection +EndGlobal diff --git a/Hospital/Hospital/Controllers/WeatherForecastController.cs b/Hospital/Hospital/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..43623c4 --- /dev/null +++ b/Hospital/Hospital/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Hospital.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 _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable 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(); + } + } +} \ No newline at end of file diff --git a/Hospital/Hospital/Hospital.csproj b/Hospital/Hospital/Hospital.csproj new file mode 100644 index 0000000..60bf9ea --- /dev/null +++ b/Hospital/Hospital/Hospital.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/Hospital/Hospital/Program.cs b/Hospital/Hospital/Program.cs new file mode 100644 index 0000000..48863a6 --- /dev/null +++ b/Hospital/Hospital/Program.cs @@ -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(); diff --git a/Hospital/Hospital/Properties/launchSettings.json b/Hospital/Hospital/Properties/launchSettings.json new file mode 100644 index 0000000..30f541d --- /dev/null +++ b/Hospital/Hospital/Properties/launchSettings.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:18296", + "sslPort": 44326 + } + }, + "profiles": { + "Hospital": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "launchUrl": "swagger", + "applicationUrl": "https://localhost:7080;http://localhost:5080", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Hospital/Hospital/appsettings.Development.json b/Hospital/Hospital/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/Hospital/Hospital/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/Hospital/Hospital/appsettings.json b/Hospital/Hospital/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/Hospital/Hospital/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}