I have API that based on ASP.NET Core 2.2 and I want to return result not from my public method that handles request but from an inner method.
public class UsersController : MainController
{
[HttpGet("{id:int}")]
public IActionResult Get(int id)
{
var value = GetSomeValue();
}
private string GetSomeValue()
{
// and here I want to return result to user not even returning result to calling method `Get`
return "";
}
}
I can set status code to response through HttpContext.Response.StatusCode
and I know how to set body to the response but I don't know either could I return response to user from GetSomeValue
method or not. May be somehow using HttpContext
?