public PlayerWindow(HockeyContext dbContext, MainWindow mainWindow, Player player) { // Predana instancia db kontextu _dbContext = dbContext; _mainWindow = mainWindow; InitializeComponent(); // Naplnim si hodnoty vekovej kategorie do combobox DataAgeCategories = Enum.GetValues(typeof(AgeCategory)); ComboBoxAgeCategories.ItemsSource = DataAgeCategories; // Naplnim si hodnoty nazvov klubov do combobox DataClubs = _dbContext.GetClubsName().ToList(); ComboBoxClubs.ItemsSource = DataClubs; // Ak je nastaveny player, je to editaca if (player != null) { TextBoxKrp.Text = player.KrpId.ToString(); TextBoxTitleBefore.Text = player.TitleBefore; TextBoxFirstName.Text = player.FirstName; TextBoxLastName.Text = player.LastName; TextBoxYearOfBirth.Text = player.YearOfBirth.ToString(); ComboBoxAgeCategories.SelectedItem = player.AgeCategory; ComboBoxClubs.SelectedItem = player.Club.Name; } }