1
protected NoContentResult SuccessWithOutData()
{
    return this.NoContent();
}

protected CreatedAtActionResult SuccessAndNoData()
{
    return ? ; // What do I return here?
}

For 201 result what do I have to return here?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 2
    Does this answer your question? [How can I code a Created-201 response using IHttpActionResult](https://stackoverflow.com/questions/23892341/how-can-i-code-a-created-201-response-using-ihttpactionresult) – Anand Sowmithiran Aug 24 '22 at 10:38

2 Answers2

1
return Ok(string);

is what I use

luhia91
  • 26
  • 3
0

You could check the Microsoft.AspNetCore.Mvc.ControllerBase class and you would find all the methods to retrun response

enter image description here

enter image description here

And you could check this document to learn the difference between responses:

https://learn.microsoft.com/en-us/aspnet/core/mvc/controllers/actions?view=aspnetcore-6.0#controller-helper-methods

Ruikai Feng
  • 6,823
  • 1
  • 2
  • 11