aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-11-10 11:06:48 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-11-10 11:06:48 +0200
commit775f0015321f91aa5be3aca079e289e89d4719f5 (patch)
treec1fe9860cc2b9a899f6ad82a24a1208f2e27f62a /Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore
parentd6db3244c15e3937d339064da0a5c7186f32daa1 (diff)
downloadTango-775f0015321f91aa5be3aca079e289e89d4719f5.tar.gz
Tango-775f0015321f91aa5be3aca079e289e89d4719f5.zip
DataStore editing..
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs29
1 files changed, 29 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs
index ddc0f6cdb..7c8cf4158 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs
@@ -17,6 +17,7 @@ using Tango.PPC.Common.ExternalBridge;
using Tango.Transport;
using Tango.Core.ExtensionMethods;
using Newtonsoft.Json.Linq;
+using Tango.BL;
namespace Tango.PPC.Common.DataStore
{
@@ -132,6 +133,34 @@ namespace Tango.PPC.Common.DataStore
}, token);
}
+ [ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStoreGetAllItemsRequest), RequestHandlerLoggingMode.LogRequestName)]
+ public async Task RemoteDataStoreGetAllItemsRequest(RemoteDataStoreGetAllItemsRequest request, String token, ExternalBridgeReceiver receiver)
+ {
+ List<RemoteDataStoreCollection> collections = new List<RemoteDataStoreCollection>();
+
+ using (ObservablesContext db = ObservablesContext.CreateDefault())
+ {
+ var items = db.DataStoreItems.ToList();
+
+ foreach (var itemsGroup in items.GroupBy(x => x.CollectionName))
+ {
+ RemoteDataStoreCollection collection = new RemoteDataStoreCollection();
+ collection.Name = itemsGroup.First().CollectionName;
+ collections.Add(collection);
+
+ foreach (var item in itemsGroup)
+ {
+ collection.Items.Add(CreateRemoteItem(item.ToDataStoreItem()));
+ }
+ }
+ }
+
+ await receiver.SendGenericResponse(new RemoteDataStoreGetAllItemsResponse()
+ {
+ Collections = collections
+ }, token);
+ }
+
private RemoteDataStoreItem CreateRemoteItem(IDataStoreItem item)
{
RemoteDataStoreItem remote = new RemoteDataStoreItem();