private async void saveButton_Click(object sender, RoutedEventArgs e)
 {
     if (nameTextBox.Text == "")
     {
         customMessagePopUp("Illegal Name", "Product must have a name");
         return;
     }
     double priceDecimal = 0;
     if (priceTextBox.Text == "" ||
         !double.TryParse(priceTextBox.Text, out priceDecimal))
     {
         customMessagePopUp("Illegal Price",
             "Price must be in decimal format with no currency symbols.\nExamples: (11), (11.99)");
         return;
     }
     priceDecimal = double.Parse(priceTextBox.Text);
     if (categoryBox.SelectedIndex == -1)
     {
         customMessagePopUp("Category not selected", "Category of product must be selected");
         return;
     }
     var newProduct = new Product
     {
         Name = nameTextBox.Text,
         Price = priceDecimal,
         CategoryId = (categoryBox.SelectionBoxItem as Category).Id
     };
     await ThreadPool.RunAsync(workitem => { dh.AddProduct(newProduct); });
     nameTextBox.IsReadOnly = true;
     priceTextBox.IsReadOnly = true;
     saveButton.IsEnabled = false;
     RefreshData(new object(), new RoutedEventArgs());
 }
 /// <summary>
 /// Updates product info.
 /// </summary>
 /// <param name="id"></param>
 /// <param name="product"></param>
 /// <returns></returns>
 public async Task<bool> UpdateProduct(int id, Product product)
 {
     var _product = new Product
     {
         Id=product.Id,
         CategoryId = product.CategoryId,
         Name = product.Name,
         Price = product.Price
     };
     var response = await client.PutAsJsonAsync(uriWaiters+"/" + id, _product);
     if (response.IsSuccessStatusCode)
     {
         return true;
     }
     return false;
 }
 public async void AddProduct(Product newProduct)
 {
     await Rest.AddProduct(newProduct);
 }
 /// <summary>
 /// Adds product to database.
 /// </summary>
 /// <param name="product"></param>
 /// <returns></returns>
 public async Task<bool> AddProduct(Product product)
 {
     var _product = new Product
     {
         CategoryId = product.CategoryId,
         Name = product.Name,
         Price = product.Price
     };
     HttpResponseMessage response = await client.PostAsJsonAsync(uriProducts, _product);
     if (response.IsSuccessStatusCode)
     {
         return true;
     }
     return false;
 }