终端一体化运控平台
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

WeatherForecastController.cs 1023 B

123456789101112131415161718192021222324252627282930313233
  1. using Microsoft.AspNetCore.Mvc;
  2. namespace BPASmartClient.AgvApi.Controllers
  3. {
  4. [ApiController]
  5. [Route("[controller]")]
  6. public class WeatherForecastController : ControllerBase
  7. {
  8. private static readonly string[] Summaries = new[]
  9. {
  10. "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
  11. };
  12. private readonly ILogger<WeatherForecastController> _logger;
  13. public WeatherForecastController(ILogger<WeatherForecastController> logger)
  14. {
  15. _logger = logger;
  16. }
  17. [HttpGet(Name = "GetWeatherForecast")]
  18. public IEnumerable<WeatherForecast> Get()
  19. {
  20. return Enumerable.Range(1, 5).Select(index => new WeatherForecast
  21. {
  22. Date = DateTime.Now.AddDays(index),
  23. TemperatureC = Random.Shared.Next(-20, 55),
  24. Summary = Summaries[Random.Shared.Next(Summaries.Length)]
  25. })
  26. .ToArray();
  27. }
  28. }
  29. }