Ejemplo n.º 1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult vrpta;
                vrpta = MessageBox.Show("Esta seguro de eliminar el registro?", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (vrpta == DialogResult.Yes)
                {
                    String strcod;
                    strcod = dtgLibro.CurrentRow.Cells[0].Value.ToString();

                    if (objLibroBL.EliminarLibro(strcod) == true)
                    {
                        CargarDatos();
                    }
                    else
                    {
                        throw new Exception("No se puso eliminar el registro");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message);
            }
        }
Ejemplo n.º 2
0
 protected void btnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         if (objBL.EliminarLibro(lblID.Text) == true)
         {
             Enlazar();
         }
         else
         {
             throw new Exception("No se pudo eliminar el registro porque esta asociado a otra tabla");
         }
     }
     catch (Exception ex)
     {
         lblMensaje2.Text = ex.Message;
         PopMant.Show();
     }
 }
Ejemplo n.º 3
0
        public ActionResult Eliminar(Libro Libro)
        {
            _LibroBL.EliminarLibro(Libro.Id);

            return(RedirectToAction("Index"));
        }