private void ChangeFavorite() { if (SelectedChampion == null) { return; } foreach (Champion champ in user.UserFavoriteChampions) { if (champ == SelectedChampion) { user.UserFavoriteChampions.Remove(SelectedChampion); FavoriteChampions.Remove(SelectedChampion); AllChampions.Add(SelectedChampion); UpdateProperty(nameof(IsSelectedChampionFavorite)); return; } } user.UserFavoriteChampions.Add(SelectedChampion); FavoriteChampions.Add(SelectedChampion); AllChampions.Remove(SelectedChampion); UpdateProperty(nameof(IsSelectedChampionFavorite)); }
private void InitLists() { bool favorite = false; foreach (Champion champ in ChampionsDefinition) { favorite = false; foreach (Champion favoriteChamp in user.UserFavoriteChampions) { if (favoriteChamp == champ) { favorite = true; break; } } if (favorite) { FavoriteChampions.Add(champ); } else { AllChampions.Add(champ); } } }