在我的 StudenntController 我有一个方法
public ActionResult ClassStudents(int? classRoomId)
{
var students = st.GetAll().Where(s => s.ClassRoomID == classRoomId);
ViewBag.ClassRoomTitle = clr.GetAll().Where(c=>c.ClassRoomID == classRoomId).Single().ClassRoomTitle;
return View(students);
}
当我输入 localhostxxxx/Student/ClassStudent/1 时,参数 classRoomId 为 null 并且出现错误:Sequence contains no elements 我想知道为什么 url:"{controller}/{action}/{id}" 不传递参数?