This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
Missing Ok()
in Controller
#2825
Closed
Description
I think there's a missing helper in controller to return an object. or I can't find it :)
public virtual ObjectResult Ok(object value);
so
[HttpGet("{id}")]
public IActionResult Detail(int id)
{
var ret = xxx.GetById(id);
if (ret == null) return HttpNotFound($"id {id} does not exist");
return Ok(ret);
}
instead of:
return new ObjectResult(ret);