public void writeToCsv(string connectionString)
 {
     _studentToDB = new StudentToDB(connectionString);
     _studentToDB.WriteToCsvFile();
 }
        public static void boolLoadFromCSV(string fileName)
        {
            List<StudentModel> studentModel = new List<StudentModel>();
            StudentModel tempStudent = new StudentModel();

            _studentToDBObject = new StudentToDB(_connectionString);

            using (var fileReader = new StreamReader(fileName))
            {
                string line;
                string[] details;

                while ((line = fileReader.ReadLine()) != null)
                {
                    details = line.Split(',');
                    tempStudent.Name = details[0];
                    tempStudent.EnrollmentNumber = Convert.ToInt32(details[1]);
                    tempStudent.Marks = Convert.ToInt32(details[2]);
                    tempStudent.Age = Convert.ToInt32(details[3]);
                    tempStudent.Gender = details[4];

                    studentModel.Add(tempStudent);
                }
            }

            _studentToDBObject.InsertStudent(studentModel);
        }
 public void AddStudent(string connectionString, string name, int enrollmentnumber, int marks, int age, string gender)
 {
     _studentToDB = new StudentToDB(connectionString);
     _studentToDB.AddNewStudent(name, enrollmentnumber, marks, age, gender);
 }