public static User User(Context context, int userId) { if (context.TenantId == 0) { return(new User()); } if (userId == -1) { return(new User() { TenantId = context.TenantId, Id = -1, Name = Displays.AllUsers(context: context) }); } return(TenantCaches.Get(context.TenantId)?.UserHash?.Get(userId) ?? Anonymous(context: context)); }
public static User User(Context context, int userId) { if (context.TenantId == 0) { return(new User()); } if (userId == -1) { return(new User() { TenantId = context.TenantId, Id = -1, Name = Displays.AllUsers(context: context) }); } return(TenantCaches.Get(context.TenantId)?.UserHash? .Where(o => o.Key == userId) .Select(o => o.Value) .FirstOrDefault() ?? Anonymous(context: context)); }