示例#1
0
        internal static void Update(string typeOfData)
        {
            fileRepository = fileFactory.CreateFileManager(typeOfData);
            Student returnedStudent;
            string  id;

            do
            {
                System.Console.WriteLine("Please enter the id of the student:");
                id = System.Console.ReadLine();

                returnedStudent = fileRepository.GetById(id);
            } while (returnedStudent == null);

            Console.WriteLine("Enter the new values:");
            Console.WriteLine("Name:");
            returnedStudent.Name = Console.ReadLine();
            Console.WriteLine("Surname:");
            returnedStudent.Surname = Console.ReadLine();
            Console.WriteLine("Birthday:");
            returnedStudent.Birthday = Console.ReadLine();

            var newReturnedStudent = fileRepository.Update(id, returnedStudent);

            Console.WriteLine(newReturnedStudent);
        }
示例#2
0
        public static Student SelectById(string typeOfData)
        {
            fileRepository = fileFactory.CreateFileManager(typeOfData);
            Student returnedStudent;

            do
            {
                System.Console.WriteLine("Please enter the id of the student:");
                var id = System.Console.ReadLine();
                returnedStudent = fileRepository.GetById(id);
            } while (returnedStudent == null);

            Console.WriteLine(returnedStudent.StudentGuid.ToString());
            return(returnedStudent);
        }