From 7c4d557dc40bc03f9000626bad37ae3e0181b9d3 Mon Sep 17 00:00:00 2001 From: ryzij Date: Tue, 7 Jul 2026 03:36:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D1=87=D0=B0=D0=BB=20=D0=B4=D0=B5?= =?UTF-8?q?=D0=BB=D0=B0=D1=82=D1=8C=20=D0=BF=D0=B0=D0=BD=D0=B5=D0=BB=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/WeatherForecastController.cs | 26 ++++++++++++++++++ .../MonitorPanel.API/MonitorPanel.API.csproj | 18 +++++++++++++ .../MonitorPanel.API/MonitorPanel.API.http | 6 +++++ .../MonitorPanel/MonitorPanel.API/Program.cs | 27 +++++++++++++++++++ .../Properties/launchSettings.json | 23 ++++++++++++++++ .../MonitorPanel.API/appsettings.json | 9 +++++++ .../MonitorPanel.Core/Models/Server.cs | 17 ++++++++++++ .../Models/WeatherForecast.cs | 12 +++++++++ .../MonitorPanel.Core.csproj | 9 +++++++ Backend/MonitorPanel/MonitorPanel.slnx | 4 +++ 10 files changed, 151 insertions(+) create mode 100644 Backend/MonitorPanel/MonitorPanel.API/Controllers/WeatherForecastController.cs create mode 100644 Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.csproj create mode 100644 Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.http create mode 100644 Backend/MonitorPanel/MonitorPanel.API/Program.cs create mode 100644 Backend/MonitorPanel/MonitorPanel.API/Properties/launchSettings.json create mode 100644 Backend/MonitorPanel/MonitorPanel.API/appsettings.json create mode 100644 Backend/MonitorPanel/MonitorPanel.Core/Models/Server.cs create mode 100644 Backend/MonitorPanel/MonitorPanel.Core/Models/WeatherForecast.cs create mode 100644 Backend/MonitorPanel/MonitorPanel.Core/MonitorPanel.Core.csproj create mode 100644 Backend/MonitorPanel/MonitorPanel.slnx diff --git a/Backend/MonitorPanel/MonitorPanel.API/Controllers/WeatherForecastController.cs b/Backend/MonitorPanel/MonitorPanel.API/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..68e2b4d --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.API/Controllers/WeatherForecastController.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Mvc; +using MonitorPanel.Core.Models; + +namespace MonitorPanel.API.Controllers; + +[ApiController] +[Route("[controller]")] +public class WeatherForecastController : ControllerBase +{ + private static readonly string[] Summaries = + [ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + ]; + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } +} diff --git a/Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.csproj b/Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.csproj new file mode 100644 index 0000000..223e972 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.csproj @@ -0,0 +1,18 @@ + + + + net10.0 + enable + enable + + + + + + + + + + + + diff --git a/Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.http b/Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.http new file mode 100644 index 0000000..d21e8c3 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.API/MonitorPanel.API.http @@ -0,0 +1,6 @@ +@MonitorPanel.API_HostAddress = http://localhost:5068 + +GET {{MonitorPanel.API_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/Backend/MonitorPanel/MonitorPanel.API/Program.cs b/Backend/MonitorPanel/MonitorPanel.API/Program.cs new file mode 100644 index 0000000..1b05030 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.API/Program.cs @@ -0,0 +1,27 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi +builder.Services.AddOpenApi(); + +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.MapOpenApi(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.UseSwagger().UseSwaggerUI(); + +app.Run(); diff --git a/Backend/MonitorPanel/MonitorPanel.API/Properties/launchSettings.json b/Backend/MonitorPanel/MonitorPanel.API/Properties/launchSettings.json new file mode 100644 index 0000000..87bcf34 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.API/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5068", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7204;http://localhost:5068", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Backend/MonitorPanel/MonitorPanel.API/appsettings.json b/Backend/MonitorPanel/MonitorPanel.API/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.API/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/Backend/MonitorPanel/MonitorPanel.Core/Models/Server.cs b/Backend/MonitorPanel/MonitorPanel.Core/Models/Server.cs new file mode 100644 index 0000000..5fbb7d2 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.Core/Models/Server.cs @@ -0,0 +1,17 @@ +namespace MonitorPanel.Core.Models; + +public class Server( + Guid id, + string name, + bool isHttps, + string address, + string? path, + int port) +{ + public readonly Guid Id = id; + public string Name { get; set; } = name; + public bool IsHttps { get; set; } = isHttps; + public string Address { get; set; } = address; + public string? Path { get; set; } = path; + public int Port { get; set; } = port; +} \ No newline at end of file diff --git a/Backend/MonitorPanel/MonitorPanel.Core/Models/WeatherForecast.cs b/Backend/MonitorPanel/MonitorPanel.Core/Models/WeatherForecast.cs new file mode 100644 index 0000000..286a19b --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.Core/Models/WeatherForecast.cs @@ -0,0 +1,12 @@ +namespace MonitorPanel.Core.Models; + +public class WeatherForecast +{ + public DateOnly Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } +} diff --git a/Backend/MonitorPanel/MonitorPanel.Core/MonitorPanel.Core.csproj b/Backend/MonitorPanel/MonitorPanel.Core/MonitorPanel.Core.csproj new file mode 100644 index 0000000..b760144 --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.Core/MonitorPanel.Core.csproj @@ -0,0 +1,9 @@ + + + + net10.0 + enable + enable + + + diff --git a/Backend/MonitorPanel/MonitorPanel.slnx b/Backend/MonitorPanel/MonitorPanel.slnx new file mode 100644 index 0000000..d433a4e --- /dev/null +++ b/Backend/MonitorPanel/MonitorPanel.slnx @@ -0,0 +1,4 @@ + + + +