private void btnDelete_Click(object sender, EventArgs e) { var canDelete = MessageBox.Show("Are you sure you want to delete this income?\n" + "Once done, it can not be undone!", "Deleting...", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (canDelete == DialogResult.OK) { _incomeService.Delete(currentIncome.Id); Close(); } }
public Result Delete(Income Income) { var result = new Result(); try { IncomeService IncomeService = new IncomeService(); IncomeService.Delete(Income); result.IsSuccess = true; } catch (Exception exception) { result.IsSuccess = false; result.ExceptionInfo = exception; } return(result); }