Вот обновленный вид
@using FirstApp.Models
@model IEnumerable<Student>
<table width="400">
<tr>
<th>ID</th>
<th>Name</th>
<th>Roll Number</th>
<th>Branch</th>
<th>Course</th>
<th>Year</th>
</tr>
@foreach (var s in Model)
{
<tr>
<td>@s.ID</td>
<td>@s.Name</td>
<td>@s.RollNo</td>
<td>@s.Branch</td>
<td>@s.Course</td>
<td>@s.Year</td>
</tr>
}
</table>
Обновленные модели будут:
public class Student
{
public int ID;
public string Name;
public string RollNo;
public string Branch;
public string Course;
public string Year;
}
public class StudentData
{
public IEnumerable<Student> Data()
{
return new List<Student>{
new Student{
ID = 1,
Name = "Narender",
RollNo = "0177EC161067",
Branch = "EC",
Course = "B.E",
Year = "IV"
},
new Student{
ID = 2,Name = "Sandeep",
RollNo = "0177CS161001",
Branch = "CSE",
Course = "B.E",
Year = "IV"
}
};
}
}