예제 #1
0
 private void lstMarca_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (lstMarca.SelectedItem != null)
     {
         ClaseEditorial MarcaSeleccionada = (ClaseEditorial)lstMarca.SelectedItem;
         txtId.Text       = MarcaSeleccionada.EditorialID.ToString();
         txtINombre.Text  = MarcaSeleccionada.NombreEditorial;
         txtDi.Text       = MarcaSeleccionada.Direccion;
         txtTelefono.Text = MarcaSeleccionada.Telefono;
         txtCiudad.Text   = MarcaSeleccionada.CiudadID.ToString();
     }
 }
        /* public static async Task<bool> NuevaEditorial(ClaseEditorial m)
         * {
         *
         *   using (var clientPratt = new HttpClient())
         *   {
         *       clientPratt.BaseAddress = new Uri("http://localhost:52373/");
         *       clientPratt.DefaultRequestHeaders.Accept.Clear();
         *       clientPratt.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
         *
         *       //HttpResponseMessage respuestaPratt = await clientPratt.PostAsJsonAsync("api/Editoriales", m);
         *      // return respuestaPratt.IsSuccessStatusCode;
         *   }
         * }
         */
        /*  public static async Task<bool> ActualizarEditorial(ClaseEditorial m)
         * {
         *
         *  using (var clientPratt = new HttpClient())
         *  {
         *      clientPratt.BaseAddress = new Uri("http://localhost:52373/");
         *      clientPratt.DefaultRequestHeaders.Accept.Clear();
         *      clientPratt.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
         *      //HttpResponseMessage respuestaPratt = await clientPratt.PutAsJsonAsync("api/Editoriales/" + m.EditorialID, m);
         *     // return respuestaPratt.IsSuccessStatusCode;
         *  }
         * }
         */
        public static async Task <bool> EliminarEditorial(ClaseEditorial m)
        {
            using (var clientPratt = new HttpClient())
            {
                clientPratt.BaseAddress = new Uri("http://localhost:52373/");
                clientPratt.DefaultRequestHeaders.Accept.Clear();
                clientPratt.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage respuestaPratt = await clientPratt.DeleteAsync("api/Editoriales/" + m.EditorialID);

                return(respuestaPratt.IsSuccessStatusCode);
            }
        }