aboutsummaryrefslogtreecommitdiff
path: root/backend/api/api/Services/ExperimentService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'backend/api/api/Services/ExperimentService.cs')
-rw-r--r--backend/api/api/Services/ExperimentService.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/backend/api/api/Services/ExperimentService.cs b/backend/api/api/Services/ExperimentService.cs
new file mode 100644
index 00000000..a3b28da4
--- /dev/null
+++ b/backend/api/api/Services/ExperimentService.cs
@@ -0,0 +1,22 @@
+using api.Interfaces;
+using api.Models;
+using MongoDB.Driver;
+
+namespace api.Services
+{
+ public class ExperimentService : IExperimentService
+ {
+ private readonly IMongoCollection<Experiment> _experiment;
+ public ExperimentService(IUserStoreDatabaseSettings settings, IMongoClient mongoClient)
+ {
+ var database = mongoClient.GetDatabase(settings.DatabaseName);
+ _experiment = database.GetCollection<Experiment>(settings.ExperimentCollectionName);
+ }
+
+ public Experiment Create(Experiment experiment)
+ {
+ _experiment.InsertOne(experiment);
+ return experiment;
+ }
+ }
+}