Files
thinkyu/branches/1150807/Services/ServiceResponse.cs
T
sryang 577060bc78 chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore
- 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
2026-09-10 09:42:37 +08:00

46 lines
1.3 KiB
C#

using System;
using System.Xml.Serialization;
using WebLib;
namespace Education.Services
{
/// <summary>
/// 用來作爲服務回應的基底類別
/// </summary>
[Serializable]
[SoapInclude(typeof(領據處理Dropdowns))]
[SoapInclude(typeof(NameValueList))]
[SoapInclude(typeof(NameValueItem))]
public class ServiceResponse
{
public bool Success { get; set; }
public string Message { get; set; }
public object Data { get; set; }
public int TotalCount { get; set; }
public ServiceResponse()
{
Success = true;
Message = string.Empty;
Data = null;
TotalCount = 0;
}
public ServiceResponse(bool success, string message, object data = null, int totalCount = 0)
{
this.Success = success;
this.Message = message;
this.Data = data;
this.TotalCount = totalCount;
}
internal static ServiceResponse CreateSuccess(string message, object data = null, int totalCount = 0)
{
return new ServiceResponse(true, message, data, totalCount);
}
internal static ServiceResponse CreateError(string message)
{
return new ServiceResponse(false, message);
}
}
}