示例#1
0
        private void bbiDelete_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (gridView.SelectedRowsCount > 0)
            {
                if (MessageBox.Show("Are you sure?", "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    //delete call to API
                    var deleteEmployeeRequest = (GetEmployeeResponse)GetFocusedRow();

                    if (deleteEmployeeRequest == null)
                    {
                        return;
                    }

                    var deleteEmployee = Task.Run(() => HttpRequests.DeleteEmployee(deleteEmployeeRequest.Id));

                    deleteEmployee.Wait();


                    //delete in gridview
                    gridView.DeleteSelectedRows();
                }
            }

            else
            {
                NothingToModify();
            }
        }