public void GetStudentEditing(ref Student student) //Update { SelectionEditing selectionEditing = new SelectionEditing(); string str = "Для выбора параметра редактирования нажмите любую кнопку (= \tДля выхода нажмите Esc\n"; Console.WriteLine(@"Режим редактирования: 1 - Изменить Имя 2 - Изменить Фамилию 3 - Изменить Номер зачетной книги Esc - Завершить редактирование "); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(str); Console.ResetColor(); while (Console.ReadKey(true).Key != ConsoleKey.Escape) { Console.Write("Выберите параметр для изменения:"); selectionEditing = BL.DataInput(selectionEditing); switch (selectionEditing) { case SelectionEditing.ChangeFirstName: student = BL.ChangeFirstName(student); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(str); Console.ResetColor(); break; case SelectionEditing.ChangeLastName: student = BL.ChangeLastName(student); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(str); Console.ResetColor(); break; case SelectionEditing.ChangeNumberRecordBook: student = BL.ChangeNumberRecordBook(student); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(str); Console.ResetColor(); break; default: Console.WriteLine("Esc - Завершить редактирование"); break; } } }
public SelectionEditing DataInput(SelectionEditing selectionEditing) { while (!SelectionEditing.TryParse(Console.ReadLine(), out selectionEditing)) { Console.ForegroundColor = ConsoleColor.Magenta; Console.WriteLine("Ошибка ввода!!"); Console.ResetColor(); } return(selectionEditing); }