// GET: api/Courses
        public IQueryable<CourseDTO> GetCoursesForSpecificTravel(int? id)
        {
            // TODO: get the travel associated with that user, and return the right courses for that current travel

            List<CourseDTO> listeCourseDTO = new List<CourseDTO>();
            foreach (Course course in db.Courses.Include(c => c.Transport).Where(t => t.Travel.TravelId == id))
            {
                CourseDTO courseDTO = new CourseDTO(course);
                listeCourseDTO.Add(courseDTO);
            }
            return listeCourseDTO.AsQueryable<CourseDTO>();
        }
        public IHttpActionResult PutCourse(int id, CourseDTO courseDTO)
        {
            Course course = new Course();
            course.CourseID = courseDTO.Id;
            course.DepartureAddress = courseDTO.DepartureAddress;
            course.DestinationAddress = courseDTO.DestinationAddress;
            course.StartDate = courseDTO.StartDate;
            course.EndDate = courseDTO.EndDate;
            course.TransportCompanyName = courseDTO.TransportCompanyName;
            Transport transport = (Transport)db.Transports.Where(t => t.TransportName == courseDTO.TransportName).First();
            course.Travel = (Travel)db.Travels.Where(t => t.TravelId == courseDTO.TravelID).First();

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != course.CourseID)
            {
                return BadRequest();
            }

            db.Entry(course).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CourseExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
        public IHttpActionResult PostCourse(CourseDTO courseDTO)
        {
            Course course = new Course();
            course.CourseID = courseDTO.Id;
            course.DepartureAddress = courseDTO.DepartureAddress;
            course.DestinationAddress = courseDTO.DestinationAddress;
            course.StartDate = courseDTO.StartDate;
            course.EndDate = courseDTO.EndDate;
            course.TransportCompanyName = courseDTO.TransportCompanyName;
            Transport transport = (Transport)db.Transports.Where(t => t.TransportName == courseDTO.TransportName).First();
            course.Transport = transport;
            course.Travel = (Travel)db.Travels.Where(t => t.TravelId == courseDTO.TravelID).First();

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.Courses.Add(course);
            db.SaveChanges();

            return CreatedAtRoute("DefaultApi", new { id = course.CourseID }, course);
        }