//protected void Button2_Click(object sender, EventArgs e) { // Button b = sender as Button; // int prodId = int.Parse(b.CommandName); // ProductHandler ph = new ProductHandler(); // ph.DeleteProduct(prodId); // Repeater1.DataBind(); //} protected void Button2_Click(object sender, EventArgs e) { Button b = sender as Button; int prodId = int.Parse(b.CommandName); ProductHandler ph = new ProductHandler(); ph.DeleteProduct(prodId); Repeater1.DataBind(); }
protected void tableProduct_RowDeleting(object sender, GridViewDeleteEventArgs e) { int index = e.RowIndex; string productId = tableProduct.Rows[index].Cells[3].Text; int id = Int32.Parse(productId); ProductHandler.DeleteProduct(id); Response.Redirect(Request.RawUrl); }
public static Response DeleteProduct(int id) { Product p = ProductHandler.DeleteProduct(id); if (p == null) { return(new Response(false, "to-be-deleted product cannot be referenced in another table in the database")); } else { return(new Response(true)); } }
public async Task <IActionResult> DeleteProduct([FromBody] Product product) { try { if (product != null) { var response = await ProductHandler.DeleteProduct(product); if (response != null) { return(Ok(response)); } } return(StatusCode(408, new ErrorResponse() { Message = "Bad Request - Product data is null" })); } catch (Exception ex) { Logger.LogError(ex.ToString()); return(StatusCode(505, ex.Message)); } }
public static Response DeleteProduct(int ProductID) { Response response = ProductHandler.DeleteProduct(ProductID); return(response); }
public async Task <ActionResult <ProductDTO> > DeleteProduct(int ID) { return(await m_Handler.DeleteProduct(ID)); }
public void DeleteProduct(string code) { _productHandler.DeleteProduct(code); }
// Delete: Deletes specified product's information from database public IActionResult Delete(int id) { handler.DeleteProduct(id); return(RedirectToAction("Index")); }