public IApiResult DeleteMultiple(DeleteProducts operation) { var result = operation.ExecuteAsync().Result; if (result is ValidationsOutput) { return new ApiResult<List<ValidationItem>>() { Data = ((ValidationsOutput)result).Errors }; } else { return new ApiResult<object>() { Status = ApiResult<object>.ApiStatus.Success }; } }
private void btnDelete_Click(object sender, EventArgs e) { DeleteProducts deleteProduct = new DeleteProducts(); string[] data = new string[this.ltPct.dataGridListProducts.Rows.Count]; for (int i = 0; i < this.ltPct.dataGridListProducts.Rows.Count - 1; i++) { data[i] = this.ltPct.dataGridListProducts.Rows[i].Cells[0].Value.ToString() + " " + this.ltPct.dataGridListProducts.Rows[i].Cells[1].Value.ToString(); } for (int i = 0; i < data.Length - 1; i++) { deleteProduct.cmbDeleteProduct.Items.Add(data[i]); } deleteProduct.cmbDeleteProduct.Text = "-- Choisir le produit --"; this.OpenForms(deleteProduct); this.btnProductList.Enabled = true; this.btnEdit.Enabled = false; }
//delete a product through form private void btnDeleteProducts_Click(object sender, EventArgs e) { var deleteProductForm = new DeleteProducts(this, ProductList); deleteProductForm.ShowDialog(); }