private bool SaveTeam() { int id = (team == null) ? 0 : team.teamID; Team updateTeam = new Team() { teamID = id, teamName = txtName.Text, teamLogo = fileName, teamSlogan = txtSlogan.Text, barangay = new Baranggay() { id = (int)cmbBarangay.SelectedValue, name = cmbBarangay.SelectedItem.ToString(), }, tournament = tournament }; if (fileName == "") { MessageBox.Show("Please put an logo"); return(false); } if (!Team.isValid(listOfTeam, updateTeam, team)) { MessageBox.Show("The team name or baranggay are already use"); return(false); } if (TeamHelper.SaveTeam(updateTeam) == 0) { MessageBox.Show("Error saving team"); this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } this.DialogResult = System.Windows.Forms.DialogResult.OK; return(true); }