public FrmCategoriaEdit(CopanStockDAL.Cotegoria categoria) { InitializeComponent(); this.controller = new CategoriaController(); this.categoria = categoria; txtId.Text = categoria.CategoriaId.ToString(); txtCategoria.Text = categoria.CategoriaNombre; }
private void btnGuardar_Click(object sender, EventArgs e) { CopanStockDAL.Cotegoria categoria = new CopanStockDAL.Cotegoria { CategoriaNombre = txtCategoria.Text }; if (controller.Add(categoria)) { MessageBox.Show("Categoría creada correctamente."); controller.Dispose(); this.Dispose(); } else { MessageBox.Show("Error para guardar la categoría."); } this.Close(); }