Example #1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            int rowindex = dgvDatos.CurrentCell.RowIndex;
            var id       = (int)dgvDatos.Rows[rowindex].Cells[0].Value;
            var cta      = CuentasRepository.ObtenerCuentaPorId(id);

            if (MessageBox.Show(String.Format("¿Está seguro de que desea eliminar {0}?", cta.Descripcion),
                                "Eliminar Cuenta", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
            {
                try
                {
                    CuentasRepository.Eliminar(cta.Id);
                    ConsultarDatos();
                }
                catch (Exception ex)
                {
                    CustomMessageBox.ShowError(ex.Message);
                }
            }
        }
Example #2
0
 public ActionResult DeleteConfirmed(int id)
 {
     _repository.Eliminar(id);
     return(RedirectToAction("Index"));
 }
 public static void Eliminar(Cuenta cuenta)
 {
     cuentasRepository.Eliminar(cuenta);
 }