chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user