public IActionResult Delete(int id) { using (var data = new ClienteData()) data.Delete(id); return(RedirectToAction("Index")); }
public void DeleteClienteTest_Ok() { var data = new ClienteData(); var cliente = new Cliente(2, "", "", ""); var resrult = data.Delete(cliente.CliId); Assert.IsNotNull(resrult); }
private void button2_Click(object sender, EventArgs e) { String nombre = dataGridClientes.Rows[dataGridClientes.CurrentCell.RowIndex].Cells["clie_nombre"].Value.ToString(); Int32 id = (Int32)dataGridClientes.Rows[dataGridClientes.CurrentCell.RowIndex].Cells["id_cliente"].Value; DialogResult result = MessageBox.Show("Seguro quiere eliminar al cliente " + nombre + ".", "Cliente", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { data.Delete(id, out exError); if (exError == null) { cargarDataGrid(); } else { MessageBox.Show("No se pudo eliminar cliente, " + exError.Message); return; } } }
public ActionResult DeleteConfirmed( Int32?Cliente_ID ) { Cliente Cliente = new Cliente(); Cliente.Cliente_ID = System.Convert.ToInt32(Cliente_ID); Cliente = ClienteData.Select_Record(Cliente); bool bSucess = false; bSucess = ClienteData.Delete(Cliente); if (bSucess == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Can Not Delete"); } return(null); }
public int Eliminar(int idCliente) { var data = new ClienteData(); return(data.Delete(idCliente)); }
public async Task Delete(FormDataCollection form, string empresa) { var key = Convert.ToInt32(form.Get("key")); await ClienteData.Delete(key, empresa); }