Horje
ow-to-return-http-500-from-asp-net-core-rc2-web-api Code Example
ow-to-return-http-500-from-asp-net-core-rc2-web-api
From what I can see there are helper methods inside the ControllerBase class. Just use the StatusCode method:

[HttpPost]
public IActionResult Post([FromBody] string something)
{    
    //...
    try
    {
        DoSomething();
    }
    catch(Exception e)
    {
         LogException(e);
         return StatusCode(500);
    }
}
You may also use the StatusCode(int statusCode, object value) overload which also negotiates the content.




Csharp

Related
how many zeros in quinnonagintillion Code Example how many zeros in quinnonagintillion Code Example
c# press ctrl and alt Code Example c# press ctrl and alt Code Example
hardcode dropdown cshtml Code Example hardcode dropdown cshtml Code Example
linq query to fetch parent child data from same table in c# Code Example linq query to fetch parent child data from same table in c# Code Example
get link element revit api Code Example get link element revit api Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9