Exemplo n.º 1
0
 private async void AddItemToDatabase()
 {
     try
     {
         int StatusCode = await _backendConnection.SetNewItem(InventoryItem, _itemExistsInDatabase);
     }
     catch (ApiException e)
     {
         MessageBox.Show($"Fejl {e.StatusCode}", "Error!");
     }
     catch (HttpRequestException exception)
     {
         MessageBox.Show($"Der er ingen forbindele til serveren", "Error!");
     }
 }
        private async void AddToShoppingListHandler()
        {
            InventoryItem inventoryItemToShoppingList = new InventoryItem();

            inventoryItemToShoppingList.Item          = CurrentItem;
            inventoryItemToShoppingList.Amount        = 1;
            inventoryItemToShoppingList.InventoryType = 3;

            try
            {
                await _backendConnection.SetNewItem(inventoryItemToShoppingList, true);
            }
            catch (ApiException e)
            {
                MessageBox.Show($"Fejl {e.StatusCode}", "Error!");
            }
            catch (HttpRequestException exception)
            {
                MessageBox.Show($"Der er ingen forbindele til serveren", "Error!");
            }

            CameraViewModel.Camera.CameraOff();
        }