Class ApiResult
Represent a generic response from a REST API call.
Inheritance
System.Object
ApiResult
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Unosquare.PassCore.Web.Models
Syntax
public class ApiResult
Constructors
ApiResult(Object)
Initializes a new instance of the ApiResult class.
Declaration
public ApiResult(object payload = null)
Parameters
Type | Name | Description |
---|---|---|
System.Object | payload | The payload. |
Properties
Errors
Gets or sets the errors.
Declaration
public List<ApiErrorItem> Errors { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<ApiErrorItem> |
Payload
Gets or sets the payload.
Declaration
public object Payload { get; }
Property Value
Type | Description |
---|---|
System.Object |
Methods
FromModelStateErrors(ModelStateDictionary)
Adds the model state errors.
Declaration
public static ApiResult FromModelStateErrors(ModelStateDictionary modelState)
Parameters
Type | Name | Description |
---|---|---|
ModelStateDictionary | modelState | State of the model. |
Returns
Type | Description |
---|---|
ApiResult | The ApiResult from Model State. |
InvalidCaptcha()
Invalids the captcha.
Declaration
public static ApiResult InvalidCaptcha()
Returns
Type | Description |
---|---|
ApiResult | The ApiResult from Invalid Recaptcha. |
InvalidRequest()
Creates a generic invalid request response.
Declaration
public static ApiResult InvalidRequest()
Returns
Type | Description |
---|---|
ApiResult | The ApiResult wih Invalid request error. |