初始化
This commit is contained in:
38
WebApplication3/Controllers/WeatherForecastController.fs
Normal file
38
WebApplication3/Controllers/WeatherForecastController.fs
Normal file
@@ -0,0 +1,38 @@
|
||||
namespace WebApplication3.Controllers
|
||||
|
||||
open System
|
||||
open System.Collections.Generic
|
||||
open System.Linq
|
||||
open System.Threading.Tasks
|
||||
open Microsoft.AspNetCore.Mvc
|
||||
open Microsoft.Extensions.Logging
|
||||
open WebApplication3
|
||||
|
||||
[<ApiController>]
|
||||
[<Route("[controller]")>]
|
||||
type WeatherForecastController (logger : ILogger<WeatherForecastController>) =
|
||||
inherit ControllerBase()
|
||||
|
||||
let summaries =
|
||||
[|
|
||||
"Freezing"
|
||||
"Bracing"
|
||||
"Chilly"
|
||||
"Cool"
|
||||
"Mild"
|
||||
"Warm"
|
||||
"Balmy"
|
||||
"Hot"
|
||||
"Sweltering"
|
||||
"Scorching"
|
||||
|]
|
||||
|
||||
[<HttpGet>]
|
||||
member _.Get() =
|
||||
let rng = System.Random()
|
||||
[|
|
||||
for index in 0..4 ->
|
||||
{ Date = DateTime.Now.AddDays(float index)
|
||||
TemperatureC = rng.Next(-20,55)
|
||||
Summary = summaries.[rng.Next(summaries.Length)] }
|
||||
|]
|
||||
Reference in New Issue
Block a user