@model ContosoUniversity.ViewModels.InstructorIndexData @{ ViewBag.Title = "Instructors"; }

Instructors

@Html.ActionLink("Create New", "Create")

@foreach (var item in Model.Instructors) { string selectedRow = ""; if (item.InstructorID == ViewBag.InstructorID) { selectedRow = "selectedrow"; } }
Last Name First Name Hire Date Office Courses
@Html.ActionLink("Select", "Index", new { id = item.InstructorID }) | @Html.ActionLink("Edit", "Edit", new { id = item.InstructorID }) | @Html.ActionLink("Details", "Details", new { id = item.InstructorID }) | @Html.ActionLink("Delete", "Delete", new { id = item.InstructorID }) @item.LastName @item.FirstMidName @String.Format("{0:d}", item.HireDate) @if (item.OfficeAssignment != null) { @item.OfficeAssignment.Location } @{ foreach (var course in item.Courses) { @course.CourseID @: @course.Title
} }
@if (Model.Courses != null) {

Courses Taught by Selected Instructor

@foreach (var item in Model.Courses) { string selectedRow = ""; if (item.CourseID == ViewBag.CourseID) { selectedRow = "selectedrow"; } }
ID Title Department
@Html.ActionLink("Select", "Index", new { courseID = item.CourseID }) @item.CourseID @item.Title @item.Department.Name
} @if (Model.Enrollments != null) {

Students Enrolled in Selected Course

@foreach (var item in Model.Enrollments) { }
Name Grade
@item.Student.FullName @Html.DisplayFor(modelItem => item.Grade)
}