private void EliminarBtn_Click(object sender, EventArgs e) { bool result = false; try { DialogResult res = MessageBox.Show("¿Desea eliminar el proveedor?", "My Store Desktop", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.Yes) { int fila = dgvDatos.CurrentRow.Index; producto = productos.ElementAt(fila); ProductsDAO pDAO = new ProductsDAO(); result = pDAO.Delete(producto.ProductID); if (result) { GetProductos(); } else { MessageBox.Show("Error al eliminar el producto", "My Store Desktop", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show("Error al eliminar el producto: " + ex.Message, "My Store Desktop", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult <bool> Delete(int id) { ProductModel product = repository.GetProductByID(id); bool status = repository.Delete(product); return(status); }
public IActionResult Delete(int Id) { ProductModel product = productsDAO.GetProductById(Id); productsDAO.Delete(product); return(View("Index", productsDAO.GetAllProducts())); }
public ActionResult <int> Delete(int id) { ProductModel product = repository.GetProductById(id); int success = repository.Delete(product); return(success); }
public ActionResult <int> Delete(int Id) { ProductModel product = productsDAO.GetProductById(Id); int DeletedId = productsDAO.Delete(product); return(DeletedId); }
public ActionResult <int> DeleteOne(int Id) { ProductsDAO products = new ProductsDAO(); ProductModel product = products.GetProductById(Id); int success = products.Delete(product); return(success); }
/// <summary> /// Delete registers based on class values informed. MinValues and nulls are skipped. /// Must have "MultipleActiveResultSets=True" on connection string. /// </summary> /// <param name="parProductsInfo">Item to delete</param> /// <param name="transaction">Transaction context</param> /// <param name="errorMessage">Error message</param> public virtual void Delete(ProductsInfo parProductsInfo, DbTransaction transaction, out string errorMessage) { errorMessage = string.Empty; ProductsDAO.Delete(parProductsInfo, transaction, out errorMessage); //By default, the caller of this method will do the commit. //motor.Commit(); //motor.CloseConnection(); }
public ActionResult Delete(Guid id, IFormCollection collection) { try { _productsDAO.Delete(id); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
private void btnEliminar_Click(object sender, EventArgs e) { ProductsPOJO objProducto = ProductsDAO.Select(int.Parse(dtgProducts.CurrentRow.Cells[0].Value.ToString())); if (MessageBox.Show("¿Está seguro de querere eliminar el producto " + objProducto.ProductName + "?", "Eliminar producto", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (ProductsDAO.Delete(objProducto.ProductID) == true) { MessageBox.Show("Producto eliminado"); data(); } else { MessageBox.Show("El producto no pudo ser eliminado"); } } }
//GET /api/productsapi/deletebyid/products public ActionResult <IEnumerable <ProductModel> > DeleteById(ProductModel product) { repository.Delete(product); return(repository.AllProducts()); }
public IActionResult DeleteById(ProductModel product) { repository.Delete(product); return(View("Index", repository.AllProducts())); }