IActionResult là interface cho tất cả action return types. ActionResult là implementation non-generic. ActionResult<T> cho phép trả về cả typed response thành công lẫn error results.
- Các implementation phổ biến:
OkObjectResult(200),NotFoundResult(404),BadRequestResult(400),CreatedAtActionResult(201). - Dùng
ActionResult<T>trong Web API để đặc tả rõ kiểu trả về.
IActionResult is the interface for all action return types. ActionResult is the non-generic implementation. ActionResult<T> enables returning either a successful typed response or error results in the same method.
- Common implementations:
OkObjectResult(200),NotFoundResult(404),BadRequestResult(400). - Use
ActionResult<T>in Web APIs to clearly specify the success return type.