public void Insert(Registration regObj)
        {
            string insertQuery = "INSERT INTO Registraton (STUDENTID, COURSEID) VALUES (@STUDENTID, @COURSEID)";

            SqlCommand insertCommand = new SqlCommand(insertQuery);

            SqlParameter studentIDParam = new SqlParameter("@STUDENTID", SqlDbType.Int);
            studentIDParam.Value = regObj.STUDENTID;

            SqlParameter courseIDParam = new SqlParameter("@COURSEID", SqlDbType.Int);
            courseIDParam.Value = regObj.COURSEID;

            insertCommand.Parameters.Add(studentIDParam);
            insertCommand.Parameters.Add(courseIDParam);

            dataAccess.Execute(insertCommand);
        }
        public void DeleteOneRegistraion(Registration regObj)
        {
            string deleteQuery = "DELETE Registraton WHERE STUDENTID = @STUDENTID AND COURSEID = @COURSEID";

            SqlCommand deleteCommand = new SqlCommand(deleteQuery);

            SqlParameter studentIDParam = new SqlParameter("@STUDENTID", SqlDbType.Int);
            studentIDParam.Value = regObj.STUDENTID;

            SqlParameter courseIDParam = new SqlParameter("@COURSEID", SqlDbType.Int);
            courseIDParam.Value = regObj.COURSEID;

            deleteCommand.Parameters.Add(studentIDParam);
            deleteCommand.Parameters.Add(courseIDParam);

            dataAccess.Execute(deleteCommand);
        }
        public List<Registration> getList()
        {
            SqlCommand command = new SqlCommand("SELECT * FROM Registraton");

            List<Registration> regList = new List<Registration>();

            DataTable dt = dataAccess.Query(command);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Registration regObj = new Registration();
                regObj.STUDENTID = (int)dt.Rows[i][0];
                regObj.COURSEID = (int)dt.Rows[i][1];

                regList.Add(regObj);
            }

            return regList;
        }
        public void Update(Registration regObj, int changedCourseID)
        {
            string updateQuery = "UPDATE Registraton SET COURSEID = @COURSEID WHERE STUDENTID = @STUDENTID AND COURSEID = @COURSEIDTOSET";

            SqlCommand updateCommand = new SqlCommand(updateQuery);

            SqlParameter studentIDParam = new SqlParameter("@STUDENTID", SqlDbType.Int);
            studentIDParam.Value = regObj.STUDENTID;

            SqlParameter courseToSetIDParam = new SqlParameter("@COURSEIDTOSET", SqlDbType.Int);
            courseToSetIDParam.Value = regObj.COURSEID;

            SqlParameter changedCourseIDParam = new SqlParameter("@COURSEID", SqlDbType.Int);
            changedCourseIDParam.Value = changedCourseID;

            updateCommand.Parameters.Add(courseToSetIDParam);
            updateCommand.Parameters.Add(studentIDParam);
            updateCommand.Parameters.Add(changedCourseIDParam);

            dataAccess.Execute(updateCommand);
        }