public static async Task <FullStoragePOCO> BuildFullStorageDTO(StoragePOCO storage) { var result = new FullStoragePOCO { Component = await IDatabaseController.DatabaseController.GetComponent(storage.ComponentId), Count = storage.Count }; return(result); }
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(); }
public async Task <bool> UpdateComponentInStorage(StoragePOCO storage) { return(await Connection.UpdateAsync(storage) == 1); }
public async Task <bool> AddComponentToStorage(StoragePOCO storage) { return(await Connection.SaveAsync(storage)); }
public FullStoragePOCO(StoragePOCO storage) { Component = IDatabaseController.DatabaseController.GetComponent(storage.ComponentId).Result; Count = storage.Count; }