using Newtonsoft.Json;
namespace OrBit.MesFileServiceNode.Host.Model
{
public enum ExecutionState
{
///
/// 返回错误信息
///
FAIL = -1,
///
/// 请求成功,返回新数据
///
SUCCESS = 1,
}
public class ExecutionResult
{
public ExecutionState code { get; set; }
public string message { get; set; }
public object details { get; set; }
public object data { get; set; }
public string validationErrors { get; set; }
public ExecutionResult()
{
code = ExecutionState.FAIL;
}
public ExecutionResult(ExecutionState _State, string _Message, object _Value = null, dynamic _Result = null)
{
code = _State;
message = _Message;
details = _Result;
data = _Value;
}
public static ExecutionResult Success(string msg = "", object data = null, object details = null)
{
return new ExecutionResult(ExecutionState.SUCCESS, msg, data, details);
}
public static ExecutionResult Failed(string msg = "")
{
return new ExecutionResult(ExecutionState.FAIL, msg);
}
public string ToJson()
{
return JsonConvert.SerializeObject(this);
}
}
}