private void CategoryToSelectList() { categoryManager.TypeList().ToList().ForEach(I => { Types.Add(new SelectListItem() { Text = I.Value, Value = I.Id.ToString() }); }); categoryManager.YearList().ToList().ForEach(I => { Years.Add(new SelectListItem() { Text = I.Value, Value = I.Id.ToString() }); }); Years = Years.OrderBy(I => I.Text).ToList(); categoryManager.ImdbList().ToList().ForEach(I => { ImdbPoints.Add(new SelectListItem() { Text = I.Value, Value = I.Id.ToString() }); }); ImdbPoints = ImdbPoints.OrderBy(I => I.Text).ToList(); }
public ObservableCollection <KeyValuePair <string, int> > GetGamesByDateRange(DateRange dateRange, string year = ALL_YEARS) { _gamesByDateRange.Clear(); switch (dateRange) { case DateRange.Month: List <string> allYears; if (year == ALL_YEARS) { allYears = Years.OrderBy(y => y).Take(Years.Count - 1).ToList(); } else { allYears = new List <string>() { year } }; foreach (var currentYear in allYears) { for (int month = 1; month <= 12; month++) { _gamesByDateRange.AddOrUpdate(String.Concat(month, " ", currentYear), AllPlays.Count(p => (p.Date.Year.Equals(Int32.Parse(currentYear)) && p.Date.Month.Equals(month)))); } } break; case DateRange.Year: foreach (var currentYear in Years.OrderBy(y => y).Take(Years.Count - 1)) { _gamesByDateRange.AddOrUpdate(currentYear, AllPlays.Count(p => p.Date.Year.Equals(Int32.Parse(currentYear)))); } break; default: break; } return(_gamesByDateRange); }