Home > front end >  What I have to return here for created
What I have to return here for created

Time:08-25

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?

CodePudding user response:

return Ok(string);

is what I use

CodePudding user response:

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://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/actions?view=aspnetcore-6.0#controller-helper-methods

  • Related