private void Fill() { Team team = new Team(); team.TeamID = Int32.Parse(txtTID.Text); team.Team_Name = txtTeamname.Text; var result = teamBL.SaveTeam(team); if (result.HasError) { MessageBox.Show(result.Messages[0]); return; } if (isNew) { teams.Add(result.Data); } else { var tm = teams.FirstOrDefault(t => t.TeamID == result.Data.TeamID); if (tm == null) { tm.TeamID = result.Data.TeamID; tm.Team_Name = result.Data.Team_Name; } } isNew = false; this.PopulateData(result.Data); RefreshDataGrid(); }