api cu adaugare/revocare acces

This commit is contained in:
andrei-mihnea-cerbu
2024-04-08 04:02:36 +03:00
parent 9334fa50cb
commit 48eb2adcbd
327 changed files with 261 additions and 98308 deletions
@@ -14,7 +14,7 @@ namespace Infrastructure.Services.MongoDB
{
_databaseName = databaseName;
_collectionName = collectionName;
Console.WriteLine($"Connection string: {connectionString}");
Console.WriteLine($"Database Name: {databaseName}");
Console.WriteLine($"Collection Name: {collectionName}");
@@ -23,12 +23,12 @@ namespace Infrastructure.Services.MongoDB
settings.ServerApi = new ServerApi(ServerApiVersion.V1);
_database = new MongoClient(settings);
try
try
{
var result = _database.GetDatabase("admin").RunCommand<BsonDocument>(new BsonDocument("ping", 1));
Console.WriteLine("Pinged your deployment. You successfully connected to MongoDB!");
}
catch (Exception ex)
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
@@ -71,4 +71,4 @@ namespace Infrastructure.Services.MongoDB
await collection.DeleteOneAsync(filter);
}
}
}
}