public IActionResult BadStudents(string name, int numTimes = 1) { clsStudents allStudents = new clsStudents(); clsStudents badStudents = new clsStudents(); allStudents.LoadStudents(); foreach (clsStudent student in allStudents) { if (student.Grade <= 2.0) { badStudents.Add(student); } } ViewData["Message"] = badStudents; ViewData["Number"] = badStudents.Count; return(View()); }
public IActionResult GoodStudents(string name, int numTimes = 1) { clsStudents allStudents = new clsStudents(); clsStudents goodStudents = new clsStudents(); allStudents.LoadStudents(); foreach (clsStudent student in allStudents) { if (student.Grade > 2.0) { goodStudents.Add(student); } } // ViewData["Message"] = "Hello " + name; // ViewData["NumTimes"] = numTimes; ViewData["Message"] = goodStudents; ViewData["Number"] = goodStudents.Count; return(View()); }