When I used MVC controllers I used "return OK(object);" or "return BadRequest(ErrorMessage)" and such.
How can I achieve this is Razor Pages?
I tried return new JsonResult(object); which works when the status code can be 200. But what if I want to return status code 400 with a JSON error message.