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.
44 lines
1.3 KiB
44 lines
1.3 KiB
4 months ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
|
||
|
namespace Admin.Bodk.Device
|
||
|
{
|
||
|
public class ResultData
|
||
|
{
|
||
|
public bool IsSuccess { get; set; } = true;
|
||
|
public string Message { get; set; } = "";
|
||
|
|
||
|
public ResultData() : this(true, "操作成功") { }
|
||
|
public ResultData(bool state, string msg)
|
||
|
{
|
||
|
IsSuccess = state;
|
||
|
Message = msg;
|
||
|
}
|
||
|
}
|
||
|
public class ResultData<T> : ResultData
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 操作结果的数据。
|
||
|
/// </summary>
|
||
|
public T Data { get; set; }
|
||
|
/// <summary>
|
||
|
/// 使用默认值初始化 Result 类的新实例。
|
||
|
/// </summary>
|
||
|
public ResultData() : this(true, "OK") { }
|
||
|
/// <summary>
|
||
|
/// 使用指定值初始化 Result 类的新实例。
|
||
|
/// </summary>
|
||
|
public ResultData(bool state, string msg) : this(state, msg, default(T)) { }
|
||
|
/// <summary>
|
||
|
/// 使用指定值初始化 Result 类的新实例,包括数据。
|
||
|
/// </summary>
|
||
|
public ResultData(bool isSuccess, string msg, T data)
|
||
|
{
|
||
|
this.IsSuccess = isSuccess; Message = msg; Data = data;
|
||
|
}
|
||
|
}
|
||
|
}
|