static void ModifyStudent() { int choice, id; string choiceTry, idTry; while (true) { while (true) { while (true) { Console.WriteLine("Please Enter Student ID: "); idTry = Console.ReadLine(); try { id = Int32.Parse(idTry); if (isb.StudentIsExists(id)) { break; } else { Console.WriteLine("This ID Is Not Exists! "); } } catch (Exception e) { Console.WriteLine("Please Enter A Number!"); continue; throw; } } Console.WriteLine( "////////////////////////////////////////////////////////////////////////////////////" + "\n" + "/* Modify Student */" + "\n" + "/* */" + "\n" + "/* */" + "\n" + "/* 1. Change Student ID */" + "\n" + "/* 2. Change Student Name */" + "\n" + "/* 3. Change Student Subject */" + "\n" + "/* 4. Change Student Sex */" + "\n" + "/* 5. Change Student Class Belong */" + "\n" + "/* 6. Exit */" + "\n" + "/* */" + "\n" + "/* Please Enter The Number */" + "\n" + "/* */" + "\n" + "////////////////////////////////////////////////////////////////////////////////////" + "\n"); choiceTry = Console.ReadLine(); try { choice = Int32.Parse(choiceTry); break; } catch (Exception e) { Console.WriteLine("Please Enter A Number!"); continue; throw; } } if (choice == 1) { int newId; string newIdTry; while (true) { Console.WriteLine("Please Enter New ID of Student: "); newIdTry = Console.ReadLine(); try { newId = Int32.Parse(newIdTry); isb.ChangeStudentId(id, newId); break; } catch (Exception e) { Console.WriteLine("New ID Must Be A Number! "); continue; throw; } } } else if (choice == 2) { string newName; Console.WriteLine("PLease Enter The New Name For This Student: "); newName = Console.ReadLine(); isb.ChangeStudentName(id, newName); Console.WriteLine("Name Changed Successful! "); } else if (choice == 3) { string newSubject; Console.WriteLine("PLease Enter The New Subject: "); newSubject = Console.ReadLine(); isb.ChangeStudentName(id, newSubject); Console.WriteLine("Subject Changed Successful!"); } else if (choice == 4) { string newSex; Console.WriteLine("Please Enter The New Sex: "); newSex = Console.ReadLine(); isb.ChangeStudentSex(id, newSex); Console.WriteLine("Sex Changed Successful!"); } else if (choice == 5) { int newClassId; string newClassIdTry; while (true) { Console.WriteLine("Please Enter New Class ID: "); newClassIdTry = Console.ReadLine(); try { newClassId = Int32.Parse(newClassIdTry); if (isb.AddStudentIntoClass(newClassId, id)) { Console.WriteLine("Change Student Class Belong Successful!"); } else { Console.WriteLine("Changed Error, New Class ID Is Not Exists! "); } break; } catch (Exception e) { Console.WriteLine("Class ID Must Be A Number!"); continue; throw; } } } else if (choice == 6) { break; } else { Console.WriteLine("This Choice is Not Exists! "); } } Work(); }