Exemplo n.º 1
0
 private void Button_Click_4(object sender, RoutedEventArgs e)
 {
     using (var proxy = new Proxy.ProductsServiceClient())
     {
         var total = proxy.Productos().Count();
         MessageBox.Show(Convert.ToString(total));
     }
 }
Exemplo n.º 2
0
        private async void Button_Click_2(object sender, RoutedEventArgs e)
        {
            using (var proxy = new Proxy.ProductsServiceClient())
            {
                var products = await proxy.ProductosAsync();

                lstResults.ItemsSource = products.Select(x => x.Name);
            }
        }
Exemplo n.º 3
0
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            using (var proxy = new Proxy.ProductsServiceClient())
            {
                int.TryParse(txtId.Text, out int _idProduct);
                var products = await proxy.GetProductsByIdAsync(_idProduct);

                MessageBox.Show(products);
            }
        }
Exemplo n.º 4
0
        private async void Button_Click_3(object sender, RoutedEventArgs e)
        {
            using (var proxy = new Proxy.ProductsServiceClient())
            {
                string nombre = txt_nombre.Text;
                string imagen = txt_imagen.Text;

                try
                {
                    await proxy.AddProductAsync(new Model.Services.Data.ProductoDTO {
                        Name = nombre, Image = imagen
                    });

                    MessageBox.Show("El producto se agregó correctamente");
                }
                catch (FaultException <ProductoFault> inventFault)
                {
                    MessageBox.Show(inventFault.Detail.Mensaje);
                }
            }
        }