예제 #1
0
        //public StudentProcessor(IStudentDao dao, IStudentParamConverter paramConverter,
        //    IStudentResultConverter resultConverter)
        //{
        //    this.Dao = dao;
        //    this.ParamConverter = paramConverter;
        //    this.ResultConverter = resultConverter;
        //}

        public StudentResult Create(StudentParam param)
        {
            Model.Student entity = ParamConverter.Convert(param, null);

            entity = Dao.Save(entity);

            return(ResultConverter.Convert(entity));
        }
예제 #2
0
        public static void ReadData(IStudentDao studentDao)
        {
            using var sr = new StreamReader("data.txt");
            string line;

            while ((line = sr.ReadLine()) != null)
            {
                var structure = line.Split(',');

                studentDao.Save(new Student
                {
                    Surname     = structure[0],
                    Name        = structure[1],
                    SecondName  = structure[2],
                    Course      = int.Parse(structure[3]),
                    Spec        = Converter.GetSpecialty(structure[4]),
                    GroupNumber = int.Parse(structure[5])
                });
            }
        }
예제 #3
0
 public void CreateNewStudent(Student student)
 {
     studentDao.Save(student);
     ShowData(studentDao.GetAll());
 }