Пример #1
0
        public static List <StudentModel> GetAllOrdered()
        {
            // from database
            // return StudentManager.GetAllOrdered().Select(s => s.ToModel()).ToList();

            // without database
            var students = Students.OrderBy(c => c.Surname).ThenBy(c => c.Name).ToList();

            foreach (var student in students)
            {
                student.Marks = MarkController.MarksByStudent(student.Name, student.Surname);
            }
            return(students);
        }
Пример #2
0
        public IActionResult View(string name, string surname)
        {
            StudentModel student = Find(name, surname);

            if (student == null)
            {
                ModelState.AddModelError("student", "student does not exists");
            }
            else
            {
                student.Marks = MarkController.MarksByStudent(name, surname);
            }

            return(View(student));
        }