Exemplo n.º 1
0
        public int Create(MymCourse mymCourse)
        {
            Command command = new Command("insert into mym_Course_cheval values (@Id_Cheval, @Id_Course)");

            command.AddParameter("Id_Cheval", mymCourse.ChevalId_Cheval);
            command.AddParameter("Id_Course", mymCourse.CoursesId_Course);

            return(_Connection.ExecuteNonQuery(command));
        }
        public void associateCourseCheval(int Id_Course, int Id_Cheval)
        {
            MymCourse mymcourse = new MymCourse()
            {
                ChevalId_Cheval  = Id_Cheval,
                CoursesId_Course = Id_Course
            };

            if (!(courseRepository.GetById(mymcourse.CoursesId_Course) is null)
                &&
                !(chevalRepository.GetById(mymcourse.CoursesId_Course) is null))
            {
                mymCourseRepository.Create(mymcourse);
            }
        }