public static IList <int> GetAvailableChampions(string rank, string role) { IList <AvgTimelineDto> avg; using (var data = new SqlData()) { avg = data.GetDistinctAvgTimeline(); } if (!string.IsNullOrWhiteSpace(rank) && rank != "All") { avg = avg.Where(a => a.Rank == rank).ToList(); } if (!string.IsNullOrWhiteSpace(role) && role != "All") { avg = avg.Where(a => a.Role == role).ToList(); } return(avg.Select(a => a.ChampionId).Distinct().ToList()); }