aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Tango.FSE.BL/Services/DataStoreService.cs
blob: 2dd29fdc40e5c8b4a96cb13132a2465618ea96a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL;
using Tango.BL.Entities;
using Tango.DataStore;

namespace Tango.FSE.BL.Services
{
    public class DataStoreService : FSEServiceBase
    {
        public Task<List<GlobalDataStoreItem>> GetGlobalDataStoreItems()
        {
            return Task.Factory.StartNew<List<GlobalDataStoreItem>>(() =>
            {
                using (ObservablesContext db = ObservablesContext.CreateDefault())
                {
                    return db.GlobalDataStoreItems.ToList().OrderBy(x => x.CollectionName).OrderBy(x => x.Key).ToList();
                }
            });
        }

        public Task<List<DataStoreItem>> GetMachinelDataStoreItems(String machineGuid)
        {
            return Task.Factory.StartNew<List<DataStoreItem>>(() =>
            {
                using (ObservablesContext db = ObservablesContext.CreateDefault())
                {
                    return db.DataStoreItems.Where(x => x.MachineGuid == machineGuid && !x.IsDeleted).ToList().OrderBy(x => x.CollectionName).OrderBy(x => x.Key).ToList();
                }
            });
        }
    }
}