Sunday, October 28, 2018

other things you may return for an IActionResult in .NET Core's MVC

Beyond returning a JsonResult when things go right, you may return stuff like this when things go South:

  • return NotFound(new { Error = ourSpecificError });
  • return new StatusCodeResult(500);
  • return new OkResult();

 
 

These are revealed on pages 202 to 205 of "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis. I don't yet know how you ideally consume the errors with Angular 5. I guess I will find that out as I keep reading.

No comments:

Post a Comment