private void ButtonApply_Click(object sender, RoutedEventArgs e) { String firstName = (FilterFirstName.Text.Trim() != "") ? FilterFirstName.Text : null; String lastName = (FilterLastName.Text.Trim() != "") ? FilterLastName.Text : null; int?krpId = null; int?birthFrom = null; int?birthTo = null; try { krpId = (FilterKrp.Text.Trim() != "") ? Int32.Parse(FilterKrp.Text) : (int?)null; } catch (Exception ex) { } try { birthFrom = (FilterBirthFrom.Text.Trim() != "") ? Int32.Parse(FilterBirthFrom.Text) : (int?)null; } catch (Exception ex) { } try { birthTo = (FilterBirthTo.Text.Trim() != "") ? Int32.Parse(FilterBirthTo.Text) : (int?)null; } catch (Exception ex) { } // Do tohoto pola si dam ID kategori, ktore su zaskrtnute List <AgeCategory> ageCategories = new List <AgeCategory>(); if ((bool)FilterCadet.IsChecked) { ageCategories.Add(AgeCategory.Cadet); } if ((bool)FilterJunior.IsChecked) { ageCategories.Add(AgeCategory.Junior); } if ((bool)FilterMidgest.IsChecked) { ageCategories.Add(AgeCategory.Midgest); } if ((bool)FilterSenior.IsChecked) { ageCategories.Add(AgeCategory.Senior); } // Zo zadania som pochopil ze sa jedna o string nazvu klubu String club = (FilterClub.Text.Trim() != "") ? FilterClub.Text : null; // Zavolanie filtrovania a aktualizovat zoznam hracov SetListPlayers(_dbContext.ApplyFilterPlayers(krpId, firstName, lastName, birthFrom, birthTo, ageCategories, club)); }