public CourseModel UpdateCourse(CourseModel courseModel)
		{
			DataTable dt = new DataTable();
			using (MySqlCommand command = new MySqlCommand())
			{
				dt = GetMultipleQuery(CourseStringsMySql.UpdateCourse(courseModel));
			}
			foreach (DataRow ms in dt.Rows)
			{
				courseModel = CourseModel.ToObject(ms);
			}

			return courseModel;
		}
Beispiel #2
0
        public CourseModel AddCourse(CourseModel courseModel)
        {
            DataTable dt = new DataTable();

            using (SqlCommand command = new SqlCommand())
            {
                dt = GetMultipleQuery(CourseStringsSql.AddCourse(courseModel));
            }
            foreach (DataRow ms in dt.Rows)
            {
                courseModel = CourseModel.ToObject(ms);
            }

            return(courseModel);
        }
Beispiel #3
0
        public List <CourseModel> GetAllCourses()
        {
            DataTable dt = new DataTable();

            using (OleDbCommand command = new OleDbCommand())
            {
                dt = GetMultipleQuery(CourseStringsInner.GetAllCourses());
            }

            List <CourseModel> arrCourse = new List <CourseModel>();

            foreach (DataRow ms in dt.Rows)
            {
                arrCourse.Add(CourseModel.ToObject(ms));
            }

            return(arrCourse);
        }
		public CourseModel GetOneCourseByCode(string courseCode)
		{
			DataTable dt = new DataTable();

			if (courseCode.Equals(string.Empty) || courseCode.Equals(""))
				throw new ArgumentOutOfRangeException();
			CourseModel courseModel = new CourseModel();

			using (MySqlCommand command = new MySqlCommand())
			{
				dt = GetMultipleQuery(CourseStringsMySql.GetOneCourseByCode(courseCode));
			}

			foreach (DataRow ms in dt.Rows)
			{
				courseModel = CourseModel.ToObject(ms);
			}

			return courseModel;
		}