Remember that grouped will only hold those things that you have grouped. If you only group adt , then city and prg will not be available in your choice.
So you need to:
- Include city and program in
grouped (otherwise they are not available) CityName and Program access within grouped collection
Something like this should do the trick:
... group new { apt, cls, prg, city } by new{apt.Gender} into grouped select new CityWiseStudentModel { CityNames = grouped.Select(g => g.city.CityName), ... programNames = grouped.Select(g => g.prg.Program) }
Niels filter
source share