public static ApiResult ToApiResultForApiStatus(this EnumApiStatus obj, string Msg = "") { return(new ApiResult { Msg = string.IsNullOrEmpty(Msg) ? obj.GetEnumDescript() : Msg, Status = obj, Result = true, }); }
public static ApiResult ToApiResultForObject(this object obj, EnumApiStatus Status = EnumApiStatus.BizOK, string Msg = "") { return(new ApiResult { Data = obj, Msg = string.IsNullOrEmpty(Msg) ? Status.GetEnumDescript() : Msg, Status = Status, Result = true, }); }
/// <summary> /// 将列表转成Api标准结果 /// </summary> /// <typeparam name="TEntity"></typeparam> /// <param name="obj"></param> /// <param name="Msg"></param> /// <param name="Status"></param> /// <returns></returns> public static ApiResult ToApiResultForList <TEntity>(this IResponse <TEntity> obj, EnumApiStatus Status = EnumApiStatus.BizOK, string Msg = "") { return(new ApiResult { Data = obj.Data, Total = obj.Total, Msg = string.IsNullOrEmpty(Msg) ? Status.GetEnumDescript() : Msg, Status = Status, Result = true, }); }