/// <summary> /// 删除商品草稿 /// </summary> /// <param name="productId"></param> /// <returns></returns> public ActionResult DeleteProduct(int productId) { string message = string.Empty; bool result = false; if (productId > 0) { result = bll.DeleteProductById(productId, CurrentUser.UserID); message = "删除成功"; } else { result = false; message = "删除失败"; } return(new JsonResult() { Data = new { result = result, message = message } }); }
//删除产品 private void btnDeletePro_Click(object sender, EventArgs e) { //是否选中 if (dgvProductInfo.SelectedRows.Count > 0) { int id = Convert.ToInt32(dgvProductInfo.SelectedRows[0].Cells[0].Value); //根据id删除选中的行 ProductInfoBLL bll = new ProductInfoBLL(); string msg = bll.DeleteProductById(id) ? "操作成功" : "操作失败"; MessageBox.Show(msg); LoadProductInfoByDelFlag(0); } else { MessageBox.Show("请选中要删除的行!"); } }