Convert ValuesController return types to ActionResult<T> (#351)

Addresses #339
This commit is contained in:
Scott Addie 2018-03-13 11:50:39 -05:00 committed by Jass Bagga
parent 12c3cf028c
commit 0879dbd082
2 changed files with 6 additions and 4 deletions

View File

@ -18,14 +18,14 @@ namespace Company.WebApplication1.Controllers
{ {
// GET api/values // GET api/values
[HttpGet] [HttpGet]
public IEnumerable<string> Get() public ActionResult<IEnumerable<string>> Get()
{ {
return new string[] { "value1", "value2" }; return new string[] { "value1", "value2" };
} }
// GET api/values/5 // GET api/values/5
[HttpGet("{id}")] [HttpGet("{id}")]
public string Get(int id) public ActionResult<string> Get(int id)
{ {
return "value"; return "value";
} }

View File

@ -13,11 +13,13 @@ type ValuesController () =
[<HttpGet>] [<HttpGet>]
member this.Get() = member this.Get() =
[|"value1"; "value2"|] let values = [|"value1"; "value2"|]
ActionResult<string[]>(values)
[<HttpGet("{id}")>] [<HttpGet("{id}")>]
member this.Get(id:int) = member this.Get(id:int) =
"value" let value = "value"
ActionResult<string>(value)
[<HttpPost>] [<HttpPost>]
member this.Post([<FromBody>] value:string) = member this.Post([<FromBody>] value:string) =