private Guid GetTeamGuid(DropDownList ddl, TextBox txt) { Guid guid = new Guid(); if (txt.Text != "") { using (FIFADataContext db = new FIFADataContext()) { Team team = (from t in db.Teams where t.Name == txt.Text select t).FirstOrDefault(); if (team == null) { team = new Team { Name = txt.Text }; db.Teams.InsertOnSubmit(team); db.SubmitChanges(); } guid = team.ID; } } else { guid = new Guid(ddl.SelectedValue); } return guid; }
partial void UpdateTeam(Team instance);
partial void DeleteTeam(Team instance);
partial void InsertTeam(Team instance);