12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- using Newtonsoft.Json;
- namespace OrBit.MesFileServiceNode.Host.Model
- {
- public enum ExecutionState
- {
- /// <summary>
- /// 返回错误信息
- /// </summary>
- FAIL = -1,
- /// <summary>
- /// 请求成功,返回新数据
- /// </summary>
- 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);
- }
- }
- }
|