diff options
author | Danijel Anđelković <adanijel99@gmail.com> | 2022-05-04 21:39:44 +0200 |
---|---|---|
committer | Danijel Anđelković <adanijel99@gmail.com> | 2022-05-04 21:39:44 +0200 |
commit | 2841a9307387eca7f1bf58f52bd406251d6e6b29 (patch) | |
tree | 0b8f831fb8bc908dab6dc4ee607ffa2c013c6487 /backend | |
parent | f5b097930797f49a97d12c9885def67a22edf02e (diff) | |
parent | da27997809160bfea0e134f7a2f44d63174447f5 (diff) |
Merge branch 'redesign' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into redesign
Diffstat (limited to 'backend')
-rw-r--r-- | backend/api/api/Controllers/ExperimentController.cs | 3 | ||||
-rw-r--r-- | backend/api/api/Interfaces/IExperimentService.cs | 2 | ||||
-rw-r--r-- | backend/api/api/Services/ExperimentService.cs | 3 |
3 files changed, 4 insertions, 4 deletions
diff --git a/backend/api/api/Controllers/ExperimentController.cs b/backend/api/api/Controllers/ExperimentController.cs index 1cac386a..6f1bbd42 100644 --- a/backend/api/api/Controllers/ExperimentController.cs +++ b/backend/api/api/Controllers/ExperimentController.cs @@ -108,9 +108,8 @@ namespace api.Controllers experiment.lastUpdated = DateTime.UtcNow; - _experimentService.Update(uploaderId, id, experiment); - return Ok($"Experiment with ID = {id} updated"); + return Ok(_experimentService.Update(uploaderId, id, experiment)); } // DELETE api/<ExperimentController>/name diff --git a/backend/api/api/Interfaces/IExperimentService.cs b/backend/api/api/Interfaces/IExperimentService.cs index 311560e8..7e59ace3 100644 --- a/backend/api/api/Interfaces/IExperimentService.cs +++ b/backend/api/api/Interfaces/IExperimentService.cs @@ -9,7 +9,7 @@ namespace api.Services public List<Experiment> GetMyExperiments(string id); public Experiment Get(string uploaderId, string name); Experiment GetOneExperiment(string userId, string id); - void Update(string userId, string id, Experiment experiment); + Experiment Update(string userId, string id, Experiment experiment); void Delete(string userId, string id); } diff --git a/backend/api/api/Services/ExperimentService.cs b/backend/api/api/Services/ExperimentService.cs index 2ad9d606..dde9111d 100644 --- a/backend/api/api/Services/ExperimentService.cs +++ b/backend/api/api/Services/ExperimentService.cs @@ -45,9 +45,10 @@ namespace api.Services return _experiment.Find(experiment => experiment.uploaderId == userId && experiment._id == id).FirstOrDefault(); } - public void Update(string userId, string id, Experiment experiment) + public Experiment Update(string userId, string id, Experiment experiment) { _experiment.ReplaceOne(experiment => experiment.uploaderId == userId && experiment._id == id, experiment); + return _experiment.Find(experiment => experiment.uploaderId == userId && experiment._id == id).FirstOrDefault(); } public void Delete(string userId, string id) |