Exemplo n.º 1
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            Autores autor = new Autores();
            int     id    = 0;

            using (var db = new DAL.Repositorio <Entidades.Autores>())
            {
                if (!Validar())
                {
                    MessageBox.Show("Favor llenar");
                }
                else
                {
                    autor.AutoresId = Utilidades.TOINT(autoresIdTextBox.Text);
                    autor.Nombre    = nombreTextBox.Text;
                    if (id != autor.AutoresId)
                    {
                        db.Mdificar(autor);
                        MessageBox.Show("Se ha Modificado");
                    }
                    else
                    {
                        if (BLL.AutoreBLL.Guardar(autor))
                        {
                            MessageBox.Show("Correcto");
                        }
                        else
                        {
                            MessageBox.Show("Error");
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            int id = 0;

            using (var db = new DAL.Repositorio <Libros>())
            {
                if (id != libro.LibrosId)
                {
                    db.Mdificar(libro);
                    MessageBox.Show("Modificado");
                }
                else
                {
                    libro = LlenarCampos();
                    if (BLL.LibroBLL.Guardar(libro))
                    {
                        MessageBox.Show("Correcto");
                    }
                    else
                    {
                        MessageBox.Show("Error");
                    }
                }
            }
        }