Talking about ASP.NET Core ecosystem and how
IActionResult
has helped, is that
IActionResult
is an interface, and the platform is the one defining a type of a response — you can create a custom response, rather than just predefined ones for returning a
View
or a resource, here you can return a response, or error as well. On the other hand,
ActionResult
is an abstract class, and you would need to make a custom class that inherits and then further stuff. But, there is
no limitation in any case
, just a friendly way to tackle the programming.
And you can also do that by following the patterns used in ASP.NET Core. Returning HttpStatusCodeResult with different codes and returning Ok, NotFound etc., needs to be checked within the team to see which is better and which is not that much useful.
How to return HTTP 500 from ASP.NET Core RC2 Web Api? - Stack Overflow
[
^
]
Since this is an interface, you can create mock classes and types to test the application as well.
Read this thread on SO as well,
asp.net core - Advantage of using IActionResult as result type in Actions - Stack Overflow
[
^
]
Read the question carefully.
Understand that English isn't everyone's first language so be lenient of bad
spelling and grammar.
If a question is poorly phrased then either ask for clarification, ignore it, or
edit the question
and fix the problem. Insults are not welcome.
Don't tell someone to read the manual. Chances are they have and don't get it.
Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.