public AddSolutionViewModel() { List<SelectListItem> tempList = new List<SelectListItem>(); var repository = new EFRepository(); repository.ProgrammingLanguages.Each(pl => { if (repository.IsProgrammingLanguageEnable(pl.ProgrammingLanguageID)) tempList.Add(new SelectListItem() { Text = pl.Title, Value = ((int)pl.ProgrammingLanguageID).ToString() }); }); ProgrammingLanguagesList = tempList; }