static public void UpdateLecturer(ref Dictionary <int, Lecturer> ListOfLecturers) { string NewName; Console.WriteLine("Please enter the Students's ID․․"); var LIDasStr = Console.ReadLine(); int LID; while (!int.TryParse(LIDasStr, out LID)) { Console.WriteLine("This is not a number! Try again.."); LIDasStr = Console.ReadLine(); } if (ListOfLecturers.ContainsKey(LID)) { Console.WriteLine("Please enter the new lecturer's name.."); NewName = Console.ReadLine(); bool allLetters; while (!(allLetters = NewName.All(c => Char.IsLetter(c))) || !(Char.IsUpper(NewName, 0))) { Console.WriteLine("Invalid name format!! Try again.."); NewName = Console.ReadLine(); } ListOfLecturers[LID].Name = NewName; ListOfLecturers[LID].University.GetLecturer(LID).Name = NewName; ListOfLecturers[LID].Faculty.GetLecturer(LID).Name = NewName; } else { Console.WriteLine("There is no lecturer on this ID!"); } }
static public void UpdateUniversity(ref Dictionary <int, University> ListOfUniversities) { string NewName; Console.WriteLine("Please enter the University's ID․․"); var UIDasStr = Console.ReadLine(); int UID; while (!int.TryParse(UIDasStr, out UID)) { Console.WriteLine("This is not a number! Try again.."); UIDasStr = Console.ReadLine(); } if (ListOfUniversities.ContainsKey(UID)) { Console.WriteLine("Please enter the new University's name.."); NewName = Console.ReadLine(); bool allLetters; while (!(allLetters = NewName.All(c => Char.IsLetter(c))) || !(NewName.IsUpper())) { Console.WriteLine("Invalid name format! Try again.."); NewName = Console.ReadLine(); } ListOfUniversities[UID].Name = NewName; } else { Console.WriteLine("There is no University on this ID!"); } }