Exemple #1
0
		/// <summary>
		/// Updates the authentication token.
		/// </summary>
		/// <param name="user">The user.</param>
		public void UpdateAuthToken(UserModel user)
		{
			var collection = database.GetCollection<UserModel>("users");
			var filter = Builders<UserModel>.Filter.Eq("UserId", user.UserId);
			var update = Builders<UserModel>.Update.Set("AuthToken", user.AuthToken);
			collection.UpdateOneAsync(filter, update).ConfigureAwait(false);
			collection.UpdateOneAsync(filter, update);
		}
Exemple #2
0
		/// <summary>
		/// Adds the user.
		/// </summary>
		/// <param name="user">The user.</param>
		public async void AddUser(UserModel user)
		{
			var collection = database.GetCollection<UserModel>("users");
			await collection.InsertOneAsync(user);
		}