コード例 #1
0
        public static Student GetStudentDataByUser(User user)
        {
            Student student = StudentData.FindStudentByFacultyNumber(user.facultyNumber);

            if (user.facultyNumber == null || student == null)
            {
                Console.WriteLine("There is no student with this user's faculty number");
                return(null);
            }
            return(student);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            Console.Write("Enter faculty number: ");
            string  facultyNumber = Console.ReadLine();
            Student student       = StudentData.FindStudentByFacultyNumber(facultyNumber);

            if (student != null)
            {
                Console.WriteLine(student);
            }
            else
            {
                Console.WriteLine("There is no student with this faculty number. ");
            }
            Console.ReadKey();
        }