public bool Delete(string productId) { ProductDAL ProductDAL = new ProductDAL(); ProductDAL.DeleteProduct(productId); return(true); }
private void dgvProduct_CellClick(object sender, DataGridViewCellEventArgs e) { DataTable data = ProductDAL.GetAllProduct(); if (dgvProduct.Columns[e.ColumnIndex].Name.Equals("Edit")) { this.Visible = false; Product x = new Product(data.Rows[e.RowIndex]["ProductId"].ToString(), data.Rows[e.RowIndex]["ProductName"].ToString(), data.Rows[e.RowIndex]["CategoryId"].ToString(), data.Rows[e.RowIndex]["Unit"].ToString(), int.Parse(data.Rows[e.RowIndex]["Price"].ToString()), int.Parse(data.Rows[e.RowIndex]["Quantity"].ToString()), bool.Parse(data.Rows[e.RowIndex]["Discontinued"].ToString()), DateTime.Parse(data.Rows[e.RowIndex]["CreateDate"].ToString())); this.Visible = false; EditProductGUI editProductGUI = new EditProductGUI(x); editProductGUI.ShowDialog(); RefreshProduct(); this.Visible = true; } if (dgvProduct.Columns[e.ColumnIndex].Name.Equals("Delete")) { if (MessageBox.Show("Do you want delete the this row?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ProductDAL.DeleteProduct(data.Rows[e.RowIndex]["ProductId"].ToString()); RefreshProduct(); } else { MessageBox.Show("Delete false."); } } }
public ActionResult RemoveFromCart() { ProductDAL proDAL = new ProductDAL(); int id = Convert.ToInt32(TempData["pid"]); proDAL.DeleteProduct(id); return(RedirectToAction("ShowCart")); }
}//End of deactivateProduct(.) public Boolean DeleteProduct(Product product) { if (product == null) { throw new ArgumentException("The product was null, therefore it cannot be deleted."); } return(ProductDAL.DeleteProduct(product, _connection)); }//End of deleteProduct(.)
public void DeleteProduct(ProductDTO product) { BillInfoDTO billInfo = new BillInfoDTO(); BillDTO billDTO = new BillDTO(); billInfo.Tivi = product; billInfoBUS.DelNGetBill(billInfo); data.DeleteProduct(product); }
public IActionResult DeleteProduct(string PID) { InitView(); ProductModel product = null; try { var productDal = new ProductDAL(_configuration); product = productDal.GetProduct(Convert.ToInt32(PID)); productDal.DeleteProduct(PID); ViewBag.ErrorMessage = string.Empty; } catch (Exception) { ViewBag.ErrorMessage = "Unable to delete product from database"; } return(View("DeleteProduct", product)); }
private void btnDelete_Click(object sender, EventArgs e) { // get the id of Products which we ant to Delete proBll.Id = int.Parse(txtProductID.Text); //Cerating bool Variable to Delete The Product bool success = proDal.DeleteProduct(proBll); if (success == true) { MessageBox.Show(" Product DELETED Successfully"); Clear(); //Refreshing DataGrid View DataTable dt = proDal.SelectProduct(); dGVProducts.DataSource = dt; } else { MessageBox.Show("Failed to Delete Product"); } }
public HttpResponseMessage DeleteProduct(Product product) { ResponseMessage <Product> objResponseData = new ResponseMessage <Product>(); try { int isDeleted = objProductDAL.DeleteProduct(product); if (isDeleted > 0) { objResponseData = ResponseHandler <Product> .CreateResponse(objResponseData, "Product Has Been Deleted.", HttpStatusCode.OK); } else { objResponseData = ResponseHandler <Product> .CreateResponse(objResponseData, "Can't Delete Product", HttpStatusCode.NoContent); } } catch (System.Exception ex) { objErrorLogger.ErrorLog(ex); objResponseData = ResponseHandler <Product> .CreateErrorResponse(objResponseData); } return(Request.CreateResponse(objResponseData.StatusCode, objResponseData)); }
public bool DeleteProduct(int id) { return(productDAL.DeleteProduct(id)); }
public void DeleteProduct(int id) { productDal.DeleteProduct(id); }
/// <summary> /// delete /// </summary> /// <param name="id"></param> public void DeleteProduct(int id) { ProdDAL.DeleteProduct(id); }
/// <summary> /// Delete the product(s) /// </summary> /// <param name="Ids">The product ids to delete</param> public void DeleteProduct(List <int> Ids, int?userId) { productDAL.DeleteProduct(Ids, userId); }
public ActionResult Delete(string id) { pDAL.DeleteProduct(Convert.ToInt32(id)); return(RedirectToAction("Index")); }