[HttpGet, Route("widgets/{customerId:long}")
public async Task<IHttpActionResult> GetWidgets(long customerId)
{
List<OrderNumber> widgets = new List<OrderNumber>()
{
new Widget()
{
PartNumber = 4534,
Name = "FlapTrapWackyWonk"
},
new Widget()
{
PartNumber = 346456346,
Name = "GusGuffGunkGooey"
}
};
return Json(widgets);
}
becomes...
[HttpGet, Route("widgets/{customerId:long}")
public async Task<IHttpActionResult> GetWidgets(long customerId)
{
List<OrderNumber> widgets = new List<OrderNumber>()
{
new Widget()
{
PartNumber = 4534,
Name = "FlapTrapWackyWonk"
},
new Widget()
{
PartNumber = 346456346,
Name = "GusGuffGunkGooey"
}
};
return Json(await Task.FromResult(widgets));
}
No comments:
Post a Comment