ビューでそれらをループできるように、「ProgramYears」の一意のインスタンスのみを返す必要がある LINQ to Entities クエリがあります。重複しないようにこれを変更する方法がわかりません。
var data = from SurveyProgramModel in surveyProgramRepository.Get()
where SurveyProgramModel.ProgramYear == ProgramYear
group SurveyProgramModel by SurveyProgramModel.ProgramTypeId into programTypeGroup
select new ProgramTypeViewModel()
{
ProgramTypeIds = programTypeGroup.Key,
ProgramIds = programTypeGroup.Select(r => r.ProgramId),
ProgramYears = programTypeGroup.Select(r => r.ProgramYear),
ProgramTitles = programTypeGroup.Select(r => r.ProgramTitle),
ProgramTypes = programTypeGroup.Select(r => r.ProgramType.ProgramType).Distinct(),
};