public static void AddNewStudnet(Student student, StudentRespository studentRepository) { studentRepository = new StudentRespository(); student = new Student(); System.Console.Write("Student Id : "); student.StudenId = int.Parse(System.Console.ReadLine()); System.Console.Write("Name : "); student.Name = System.Console.ReadLine(); System.Console.Write("Surname : "); student.Surname = System.Console.ReadLine(); System.Console.Write("Birthday : "); student.Birthday = DateTime.Parse(System.Console.ReadLine()).Date; if (studentRepository.IsExistData()) { if (studentRepository.FoundStudentById(student).StudenId != student.StudenId) { studentRepository.AddStudent(student); System.Console.WriteLine("Adding new Student!!"); } else { System.Console.WriteLine("Student already exist!!"); } } else { studentRepository.AddStudent(student); System.Console.WriteLine("Adding new Student!!"); } System.Console.ReadKey(); }
public static void EditStudentById(Student student, StudentRepository studentRepository) { student = new Student(); studentRepository = new StudentRespository(); student.StudenId = studentIdStatic; studentRepository.UpdateStudentById(student); System.Console.Write("Student Id : "); student.StudenId = int.Parse(System.Console.ReadLine()); System.Console.Write("Name : "); student.Name = System.Console.ReadLine(); System.Console.Write("Surname : "); student.Surname = System.Console.ReadLine(); System.Console.Write("Birthday : "); student.Birthday = DateTime.Parse(System.Console.ReadLine()).Date; studentRepository.AddStudent(student); System.Console.WriteLine("Student Update!!"); }