51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using System.Text.Json;
|
|
using WebApi.Project.ProxyKMS.Models;
|
|
|
|
namespace WebApi.Project.ProxyKMS.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()
|
|
{
|
|
MasterEcuKey.Response_SupplierKeyProvisioning res = new MasterEcuKey.Response_SupplierKeyProvisioning();
|
|
res.ResultMessage = "";
|
|
res.ResultStatus = "";
|
|
res.ResultReason = "";
|
|
|
|
res.Records.M1 = "M11";
|
|
res.Records.M2 = "M22";
|
|
res.Records.M3 = "M33";
|
|
res.Records.M4 = "M44";
|
|
res.Records.M5 = "M55";
|
|
res.Records.KeyID = "key";
|
|
|
|
var serialize = JsonSerializer.Serialize(res, new JsonSerializerOptions() { WriteIndented = true });
|
|
var desObj = JsonSerializer.Deserialize<MasterEcuKey.Response_SupplierKeyProvisioning>(serialize);
|
|
|
|
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();
|
|
}
|
|
}
|
|
}
|