api updates
This commit is contained in:
parent
d6a31a5f67
commit
6743364423
|
|
@ -17,18 +17,6 @@ namespace Company.WebApplication1.Controllers
|
|||
[ApiController]
|
||||
public class WeatherController : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public ActionResult<WeatherResult> GetWeatherResult(string location)
|
||||
{
|
||||
var rng = new Random();
|
||||
return new WeatherResult
|
||||
{
|
||||
Location = location,
|
||||
Temperature = rng.Next(-20, 55),
|
||||
TemperatureUnit = TemperatureUnit.Celsius
|
||||
};
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public ActionResult<WeatherResult> GetWeatherForecasts(string location, TemperatureUnit unit)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace WebApplication1.Controllers
|
||||
namespace WebApplication1.Controllers
|
||||
|
||||
open System
|
||||
open System.Collections.Generic
|
||||
|
|
@ -22,25 +22,11 @@ type WeatherController () =
|
|||
inherit ControllerBase()
|
||||
|
||||
[<HttpGet>]
|
||||
[<Route("GetWeatherByLocationWithUnit")>]
|
||||
member this.Get(location:string, unit: string) =
|
||||
let rnd = System.Random()
|
||||
let result:WeatherResult = {
|
||||
Location = location;
|
||||
Temperature = rnd.Next(-20,55);
|
||||
TemperatureUnit = System.Enum.Parse(typeof<TemperatureUnit>,unit)
|
||||
:?> TemperatureUnit
|
||||
TemperatureUnit = unit
|
||||
}
|
||||
ActionResult<WeatherResult>(result)
|
||||
|
||||
[<HttpGet>]
|
||||
[<Route("GetWeatherByLocation")>]
|
||||
member this.Get(location:string) =
|
||||
let rnd = System.Random()
|
||||
let result:WeatherResult = {
|
||||
Location = location;
|
||||
Temperature = rnd.Next(-20,55);
|
||||
TemperatureUnit = TemperatureUnit.Celsius
|
||||
|
||||
}
|
||||
ActionResult<WeatherResult>(result)
|
||||
ActionResult<WeatherResult>(result)
|
||||
Loading…
Reference in New Issue