Request.CreateResponse in asp.net core
Finally I make a solution. :)
[HttpPost]
public HttpResponseMessage AddBusinessUsersToBusinessUnit(MyObject request)
{
return new HttpResponseMessage(HttpStatusCode.Unauthorized);
}
If you just want to return a status code, the following is preferable
//Creates a StatusCodeResult object by specifying a statusCode.
//so controller method should return IActionResult
return StatusCode(HttpStatusCode.Unauthorized)
See more in this SO answer