示例#1
0
        public static async Task <FullStoragePOCO> BuildFullStorageDTO(StoragePOCO storage)
        {
            var result = new FullStoragePOCO
            {
                Component = await IDatabaseController.DatabaseController.GetComponent(storage.ComponentId),
                Count     = storage.Count
            };

            return(result);
        }
示例#2
0
        private async void Components_ComponentAddButton_Click(object sender, RoutedEventArgs e)
        {
            var newComponent = new ComponentPOCO()
            {
                ComponentName = "ComponentName",
                ComponentType = "ComponentType"
            };
            await DatabaseProvider.Database.AddComponent(newComponent);

            AllComponents.Add(newComponent);
            var newStorage = new StoragePOCO()
            {
                ComponentId = newComponent.Id,
                Count       = 0
            };
            await DatabaseProvider.Database.AddComponentToStorage(newStorage);

            var storage = await FullStoragePOCO.BuildFullStorageDTO(newStorage);

            AllStorage.Add(storage);

            RefreshStorageDataGrid();
            RefreshComponentsDataGrid();
        }
示例#3
0
 public async Task <bool> UpdateComponentInStorage(StoragePOCO storage)
 {
     return(await Connection.UpdateAsync(storage) == 1);
 }
示例#4
0
 public async Task <bool> AddComponentToStorage(StoragePOCO storage)
 {
     return(await Connection.SaveAsync(storage));
 }
示例#5
0
 public FullStoragePOCO(StoragePOCO storage)
 {
     Component = IDatabaseController.DatabaseController.GetComponent(storage.ComponentId).Result;
     Count     = storage.Count;
 }