private void button3_Click(object sender, EventArgs e) { Categoria categoria = new Categoria("Periferico"); int result = AdminCategoria.Crear(categoria); if (result > 0) { MessageBox.Show("OK"); ShowAllCategories(); } else { MessageBox.Show("Fallo"); } }
protected void btnInsertarCategoria_Click(object sender, EventArgs e) { Categoria categoria = new Categoria(TextBox1.Text); int idCreado = AdminCategoria.Crear(categoria); if (idCreado > 0) { lblCheck.Text = "Insertado Ok"; TraerTodasLasCategorias(); ComboCategoria.Items.Add(Convert.ToString(idCreado)); } else { lblCheck.Text = "Fallo Insert"; } }