Json
This part provides json-related controller extensions and actions results.
JsonResponse
JsonResponse
class represents a result containing data object, errors list, message and success marker. It has following properties:
Property name | Property type | Description |
---|---|---|
Ok |
|
|
Message |
| A message supplementing the result. Contains text of specified message or first error's message or |
Data |
| A data attached to result; |
Errors | A list of errors contained in result; |
The class has different constructors allowing to specify this properties in different combinations.
Working with class is performed by using controller extension methods that wrap instances of JsonResponse
with JsonResult
.
JsonResponseError
This class represents an error to be transferred to a client.
Property name | Property type | Description |
---|---|---|
Key |
| Key corresponding to an error. |
Message |
| Message corresponding to an error. |
JavaScriptController extensions
These extension methods provide possibilities of sending JsonResponse
wrapped in JsonResult
:
Method name | Return type | Description |
---|---|---|
JsonResponse |
| Creates a |
There are several overloads of this method taking as parameters the success marker, message, errors list and data.
Last updated