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); }
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(); }