How to populate a view models using a linq query ASP.NET MVC 5 Entity Framework

Ok so this is a follow-up from MVC 5 ASP.NET Entity Framework Collect Form Data through Range Input , My Database Structure Consists of a Survey Having Many Categories, A Category having many Questions, then a Question having many QuestionResults and finally QuestionResults having many CategoryResults, in the HomeController I have the models being bound through the ViewModel, but I now require it to be populated with my entities through the context with Linq, any help will be greatly appreciated.

Get distinct values from list

public List<MAS_EMPLOYEE_TRANSFER> GetEmployeeTransferListForHR(TimecardDataContext TimecardDC) { List<MAS_EMPLOYEE_TRANSFER> objEmployeeTransferList = null; try { objEmployeeTransferList = new List<MAS_EMPLOYEE_TRANSFER>(); objEmployeeTransferList = TimecardDC.MAS_EMPLOYEE_TRANSFER.Where( employee => employee.HR_ADMIN_IND=="Y").ToList(); } finally { } return objEmployeeTransferList; } It shows all list of values where hr admin indicator=yes. But I have to get hr admin=yes and distinct(empid) from the table MAS_EMPLOYEE_TRANSFER. How to get distinct … Read more