I have an API method that returns an object. However, if I detect some issues, I want to be able to return a certain Http status code. What's the right way to handle this in the new ASP.NET Core 1.0 API?
Here's my code:
[HttpPost]
public async Task<SomeObject> Post([FromBody] value)
{
   if(value == null)
      // I want to return HttpBadRequest code here.
   // Some logic
   return myObject;
}Returning HttpStatus codes were pretty easy in the previous version of API. What's the right -- and hopefully even easier way -- in the new version?