You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
944 B
33 lines
944 B
using System;
|
|
|
|
namespace Application.Models
|
|
{
|
|
public class ApiResponse
|
|
{
|
|
public int type { get; set; }
|
|
public int code { get; set; }
|
|
public string message { get; set; }
|
|
public string data { get; set; }
|
|
public int format { get; set; }
|
|
|
|
public static ApiResponse Success(string data, int format = 0)
|
|
{
|
|
return new ApiResponse { type = 0, code = 0, data = data, format = format };
|
|
}
|
|
|
|
public static ApiResponse AsyncSuccess()
|
|
{
|
|
return new ApiResponse { type = 1, code = 0 };
|
|
}
|
|
|
|
public static ApiResponse Error(string message, int code = 1)
|
|
{
|
|
return new ApiResponse { type = 0, code = code, message = message };
|
|
}
|
|
|
|
public static ApiResponse Error(Exception ex, int code = 1)
|
|
{
|
|
return new ApiResponse { type = 0, code = code, message = ex.Message };
|
|
}
|
|
}
|
|
} |