//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)); }
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]) }); } }
public void CreateNewStudent(Student student) { studentDao.Save(student); ShowData(studentDao.GetAll()); }