Example #1
0
        public IHttpActionResult UpdateCourse(Course course)
        {
            PenOCDataContext db = new PenOCDataContext();

            tblCourse theCourse = db.tblCourses.Single(c => c.idCourse == course.id);

            theCourse.intEvent = course.eventId;
            theCourse.strName = course.name;
            theCourse.intLength = course.length;
            theCourse.intClimb = course.climb;
            theCourse.intControls = course.controls;
            theCourse.intTechnical = course.difficultyId;
            theCourse.intListOrder = course.listOrder;

            db.SubmitChanges();

            return Ok(course);
        }
Example #2
0
        public IHttpActionResult InsertCourse(Course course)
        {
            PenOCDataContext db = new PenOCDataContext();

            tblCourse courseRecord = new tblCourse
            {
                strName = course.name,
                intEvent = course.eventId,
                intLength = course.length,
                intClimb = course.climb,
                intControls = course.controls,
                intTechnical = course.difficultyId,
                intListOrder = course.listOrder
            };

            db.tblCourses.InsertOnSubmit(courseRecord);
            db.SubmitChanges();

            course.id = courseRecord.idCourse;

            return Ok(course);
        }