ApiResultModelT Class

Any and all calls to the server that do not result a page must return this model instead. Using the StatusCode field, the end application will know how to execute the payload.

Definition

Namespace: MobileTrack.Common.Models
Assembly: MobileTrack.Common (in MobileTrack.Common.dll) Version: 0.7+ce90b2cf6b782b8d7b7fd47b3c546987c652c00f
public sealed class ApiResultModel<T>
where T : class
Inheritance
Object    ApiResultModelT

Type Parameters

T
Object type to return to the requesting service. This can be a business object deriving from IIdLabel or be a custom datatype, e.g. analytics data

Properties

Completed When the message was sent from the server.
Payload normally the payload represents a JSON object. If an error occurred, this will represent the localized human-readable error message.
Received When the request was received by the server.
StatusCode Status code of the call.
StatusMessage Contains error message, if applicable.

Methods

Failure Returns if the Api call has resulted in a technical failure. If this happens, a ticket to resolve the bug should always be opened.
Finalize Seal the ApiResult with the final status code and payload
Generate Generates a payload model.
NotFound Returns if the Api call has failed because an object could not be found. If this happens, a ticket to resolve the bug should always be opened.
UserCausedError Invoked whenever the user causes an error, e.g. because of faulty input or lack of permissions.

Extension Methods

IsApiResultModelValidT Checks whether the ApiResultModelT is in a valid state
(Defined by ModelValidatorsExtensions)

See Also