0
public async Task<IActionResult> PostQueuePrimaryInsured([FromRoute]string policyNumber, [FromBody]Queue<FormRequest> body) {
    HttpStatusCode result = _service.DoSomething(result);

    return result;
}

How do I make it return the HttpStatusCode result? I can't figure out the correct syntax. I can have it return Ok(), NotFound(), etc. but I don't want a large if-else block checking for each status code.

Soulzityr
  • 406
  • 1
  • 8
  • 26
  • 3
    Possible duplicate of [How to return a specific status code and no contents from Controller?](https://stackoverflow.com/questions/37690114/how-to-return-a-specific-status-code-and-no-contents-from-controller) – GSerg Apr 02 '20 at 20:32

1 Answers1

1

This is what I found. Please let me know if there is a better solution.

return StatusCode((int)result);
Soulzityr
  • 406
  • 1
  • 8
  • 26