add projects
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 6s

This commit is contained in:
admin
2026-03-17 17:25:08 +03:00
parent fc01f07d7c
commit ed55e77e98
39 changed files with 4430 additions and 8 deletions
+71
View File
@@ -0,0 +1,71 @@
using Microsoft.AspNetCore.Mvc;
[ApiController]
[Route("api/[controller]")]
public class TestController : ControllerBase
{
[HttpGet]
[Produces("text/html")]
public ContentResult GetSchema()
{
var html = @"
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Схема подключения</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 40px;
background: #f0f2f5;
}
.container {
max-width: 800px;
margin: 0 auto;
background: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
h1 {
color: #2c3e50;
border-bottom: 3px solid #3498db;
padding-bottom: 10px;
}
.node {
background: #3498db;
color: white;
padding: 15px;
margin: 10px;
border-radius: 5px;
display: inline-block;
}
</style>
</head>
<body>
<div class='container'>
<h1>Схема подключения устройства</h1>
<p>Эта страница возвращается из Web API контроллера</p>
<div style='text-align: center; margin: 30px 0;'>
<div class='node'>Маршрутизатор</div>
<div style='margin: 20px;'>↓</div>
<div class='node'>Коммутатор</div>
<div style='margin: 20px; display: flex; justify-content: space-around;'>
<div>
<div class='node'>Сервер</div>
<div class='node'>Компьютер 1</div>
<div class='node'>Компьютер 2</div>
</div>
</div>
</div>
<p><strong>Время генерации:</strong> " + DateTime.Now.ToString("HH:mm:ss") + @"</p>
</div>
</body>
</html>";
return Content(html, "text/html; charset=utf-8");
}
}
@@ -0,0 +1,62 @@
using Microsoft.AspNetCore.Mvc;
using System.Net;
using System.Net.Http.Headers;
namespace Wiking.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 = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
[HttpGet]
[Route("api/schema")]
public HttpResponseMessage GetHtmlPage()
{
var htmlContent = @"<!DOCTYPE html>
<html>
<head>
<title>Ñõåìà ïîäêëþ÷åíèÿ</title>
<style>
body { font-family: Arial, sans-serif; margin: 40px; }
h1 { color: #333; }
</style>
</head>
<body>
<h1>Ñõåìà ïîäêëþ÷åíèÿ óñòðîéñòâà</h1>
<p>Ýòî HTML ñòðàíèöà, âîçâðàùàåìàÿ èç WebApi êîíòðîëëåðà</p>
<div>Çäåñü ìîæåò áûòü âàøà ñõåìà ïîäêëþ÷åíèÿ</div>
</body>
</html>";
var response = new HttpResponseMessage(HttpStatusCode.OK);
response.Content = new StringContent(htmlContent);
response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
return response;
}
}
}