Skip to content

Instantly share code, notes, and snippets.

@jordan112
Created June 11, 2015 15:58
Show Gist options
  • Save jordan112/a5b1b352c2831717c013 to your computer and use it in GitHub Desktop.
Save jordan112/a5b1b352c2831717c013 to your computer and use it in GitHub Desktop.
public IQueryable<CoursesBySectionViewModel> GetCoursesBySection()
{
return from cs in this.courseSectionRepository.GetAll()
join staffmem in staffRepository.GetAll() on cs.CourseSectionID equals staffmem.CourseSectionID
select new CoursesBySectionViewModel
{
AcademicYearId = cs.AcademicYearID,
SchoolId = cs.SchoolID,
CourseSectionId = cs.CourseSectionID,
SectionName = cs.CourseSectionDescription,
GradeLevelId = cs.GradeLevelID,
GradeLevelName = cs.GradeLevelID.ToString(),
SectionNumber = cs.GradeLevelID + "A"
};
//return this.courseSectionRepository.GetAll().Project().To<CoursesBySectionViewModel>();
}
// you can also use the automapper technique as well, then you need simpler expressions such as
return this.courseSectionRepository.GetAll().Project().To<CoursesBySectionViewModel>();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment