I'm going to return a bad request result in my action filter.
I have two choices:
context.result = new BadRequestResult();
or
context.result = new BadRequestObjectResult();
It seems there are couple types for all status codes: NotFoundResult
- NotFoundObjectResult
and so on.
which one I should use and what is differences of these couple types?
Both are for similar purpose, but the second one (BadRequestObjectResult
) with the difference, an object
or a ModelStateDictionary
can be passed as a constructor argument, containing the details regarding the error.
Take a look at the constructors in below link.