设备管理
This commit is contained in:
@@ -37,6 +37,28 @@ namespace Infrastructure
|
||||
|
||||
return source;
|
||||
}
|
||||
/// <summary>
|
||||
/// 用昵称更新
|
||||
/// </summary>
|
||||
/// <typeparam name="TSource"></typeparam>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public static TSource ToUpdate_nickName<TSource>(this TSource source, HttpContext? context = null)
|
||||
{
|
||||
var types = source?.GetType();
|
||||
if (types == null || context == null) return source;
|
||||
BindingFlags flag = BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.Instance;
|
||||
|
||||
types.GetProperty("UpdateTime", flag)?.SetValue(source, DateTime.Now, null);
|
||||
types.GetProperty("UpdatedTime", flag)?.SetValue(source, DateTime.Now, null);
|
||||
types.GetProperty("Update_time", flag)?.SetValue(source, DateTime.Now, null);
|
||||
types.GetProperty("UpdateBy", flag)?.SetValue(source, context.GetNickName(), null);
|
||||
types.GetProperty("UpdatedBy", flag)?.SetValue(source, context.GetNickName(), null);
|
||||
types.GetProperty("Update_by", flag)?.SetValue(source, context.GetNickName(), null);
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user