public async Task<User> UpdateDataAsync(User user, bool validate = false) { if (!Users.ContainsKey(user.Id)) { await user.ForceValidate(); Users[user.Id] = user; } else { if (validate) { await user.ForceValidate(); } user.CopyTo(Users[user.Id]); } return Users[user.Id]; }
public User GetUser(string id) { if (!Users.ContainsKey(id)) { var user = new User(id); user.ForceValidate(); Users[id] = user; } else { Users[id].ForceValidate(); } return Users[id]; }
public async Task<User> GetUserAsync(string id) { if (!Users.ContainsKey(id)) { var user = new User(id); await user.ForceValidate(); Users[id] = user; } else { await Users[id].Validate(); } return Users[id]; }