using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ManageSystemApi.Models
{
[Serializable]
public class Result<T>
{
public int? code { get; set; }
public Boolean? success { get; set; }
public string msg { get; set; }
public List<T> dataList { get; set; }
public int totalCount { get; set; }
public int page { get; set; }
public int pageSize { get; set; }
public T data { get; set; }
public Result()
{
}
public Result(int? code, bool? success, string msg, List<T> dataList, int totalCount, int page, int pageSize)
{
this.code = code;
this.success = success;
this.msg = msg;
this.dataList = dataList;
this.totalCount = totalCount;
this.page = page;
this.pageSize = pageSize;
}
public Result(int? code, bool? success, string msg, int totalCount, int page, int pageSize,T data)
{
this.code = code;
this.success = success;
this.msg = msg;
this.data = data;
this.totalCount = totalCount;
this.page = page;
this.pageSize = pageSize;
}
public static Result<T> suc(T data)
{
return new Result<T>(0, true, "成功", 0, 0, 0, data);
}
public static Result<T> suc()
{
return new Result<T>(0, true, "成功", null, 0, 0, 0);
}
public static Result<T> suc(List<T> dataList)
{
return new Result<T>(0,true,"成功",dataList,0,0,0);
}
public static Result<T> fail(string msg)
{
return new Result<T>(1, false, msg, new List<T>(), 0, 0, 0);
}
}
}