Пример #1
0
        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();
        }
Пример #2
0
 public static void DeleteStudentById(Student student, StudentRespository studentRepository)
 {
     student           = new Student();
     studentRepository = new StudentRespository();
     student.StudenId  = studentIdStatic;
     studentRepository.DeleteStudentById(student);
 }
Пример #3
0
        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!!");
        }
Пример #4
0
        public static bool SearchStudentById(Student student, StudentRespository studentRepository)
        {
            student           = new Student();
            studentRepository = new StudentRespository();
            string number  = null;
            bool   isFound = false;

            if (!studentRepository.IsExistData())
            {
                System.Console.WriteLine("Don't exist data!!");
                return(isFound);
            }
            else
            {
                do
                {
                    System.Console.Clear();
                    System.Console.Write("Insert number id of Student : ");
                    number   = System.Console.ReadLine();
                    isNumber = int.TryParse(number, out int valor);
                } while (!isNumber);

                student.StudenId = int.Parse(number);
                studentIdStatic  = student.StudenId;
                if (studentRepository.FoundStudentById(student) != student)
                {
                    System.Console.WriteLine("Student  not found!");
                    isFound = false;
                }
                else
                {
                    HeaderData();
                    System.Console.WriteLine(student.ToString());
                    System.Console.WriteLine("Student  found it!");
                    isFound = true;
                }

                System.Console.ReadKey();

                return(isFound);
            }
        }
Пример #5
0
 /// <summary>
 /// ctor
 /// </summary>
 public StudentsController(AbstractValidator <PurchaseOrderType> validator)
 {
     _validator = validator;
     _students  = new StudentRespository();
 }