73 lines
2.0 KiB
C#
73 lines
2.0 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
|
|||
|
|
namespace APT.Infrastructure.Core
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 适用于WebApi的统一格式的分页数据结构
|
|||
|
|
/// </summary>
|
|||
|
|
/// <typeparam name="T"></typeparam>
|
|||
|
|
public class PagedActionResult<T>
|
|||
|
|
{
|
|||
|
|
private bool _isSuccessful = true;
|
|||
|
|
/// <summary>
|
|||
|
|
/// 是否执行成功
|
|||
|
|
/// </summary>
|
|||
|
|
public bool IsSuccessful
|
|||
|
|
{
|
|||
|
|
get { return this._isSuccessful; }
|
|||
|
|
set { this._isSuccessful = value; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 返回结果,如果<see cref="IsSuccessful"/>值为<see cref="true"/>时有值
|
|||
|
|
/// </summary>
|
|||
|
|
public IEnumerable<T> Data { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 其他数据
|
|||
|
|
/// </summary>
|
|||
|
|
public dynamic DynamicData { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 总记录数
|
|||
|
|
/// </summary>
|
|||
|
|
public int TotalCount { get; set; }
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 错误信息,如果<see cref="IsSuccessful"/>值为<see cref="false"/>时有值
|
|||
|
|
/// </summary>
|
|||
|
|
public String ErrorMessage { get; set; }
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 消息类型
|
|||
|
|
/// </summary>
|
|||
|
|
public EFMessageType MessageType { get; set; }
|
|||
|
|
/// <summary>
|
|||
|
|
/// 消息代码
|
|||
|
|
/// </summary>
|
|||
|
|
public string Code { get; set; }
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 構造函數
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="data"></param>
|
|||
|
|
/// <param name="totalCount"></param>
|
|||
|
|
/// <param name="result"></param>
|
|||
|
|
/// <param name="errMsg"></param>
|
|||
|
|
public PagedActionResult(IEnumerable<T> data, int totalCount, bool result = true, string errMsg = "")
|
|||
|
|
{
|
|||
|
|
Data = data;
|
|||
|
|
TotalCount = totalCount;
|
|||
|
|
IsSuccessful = result;
|
|||
|
|
ErrorMessage = errMsg;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 構造函數
|
|||
|
|
/// </summary>
|
|||
|
|
public PagedActionResult()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|