private void buttonEliminar_Click(object sender, EventArgs e) { try { if (dataGridViewDataPuesto.RowCount > 0) { IdRowSelect = dataGridViewDataPuesto.CurrentRow.Index; int IdJob = Int32.Parse(dataGridViewDataPuesto.Rows[IdRowSelect].Cells[JobML.DataBase.Id].Value.ToString()); cFAT100010 Alert = new cFAT100010("Información", String.Format("¿Desea eliminar el registro {0}?", IdJob), MessageBoxIcon.Question); Alert.ShowDialog(); if (Alert.DialogResult == DialogResult.Yes) { JobML Job = new JobML { Id = IdJob, }; JobBLL.Delete(Job); dataGridViewDataPuesto.Rows.Remove(dataGridViewDataPuesto.CurrentRow); } } else { cFAT100010 Alert = new cFAT100010("Información", "No hay datos", MessageBoxIcon.Information); Alert.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(String.Format("buttonEliminar_Click: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public JsonResult Delete(int id) { JobBLL bll = new JobBLL(); bll._conn = _configuration.GetConnectionString("ATSAppCon"); bll.Delete(id); return(new JsonResult("Deleted Successfully")); }