코스 (CourseId가있는) 및 코스 테이블의 관련 CourseName에서 데이터를 가져오고 싶습니다.linq을 사용하여 두 테이블의 데이터를 가져 와서 결과를보기로 반환
내가 다음 코드를 작성했습니다 :
var projects = from n in db.Projects
join c in db.Courses on n.CourseId equals c.ID
orderby n.Name
select new { Project = n, Course = c };
return View(projects.ToList());
내가 오류 얻을 :
The model item passed into the dictionary is of type 'System.Collections.Generic.List
1[<>f__AnonymousType2
2[ProjectManager.Models.Project,ProjectManager.Models.Course]]', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[ProjectManager.Models.Project]'.
내가 컨트롤러에서 할 필요가 있고보기에이 데이터를 표시하려면?