//
        // GET: /Trip/

        public ActionResult Index()
        {
            var viewTrip = new TripDTO
            {
                TripList = repository.GetAllTrips(),
            };
            return View(viewTrip);
        }
        public ActionResult Create(TripDTO tripDTO)
        {
            Trip trip = repository.CreateTrip(tripDTO);
            if (ModelState.IsValid)
            {
                db.Trips.Add(trip);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(trip);
        }
        //
        // GET: /Trip/Details/5

        public ActionResult Details(int id)
        {
            Trip trip = repository.GetTrip(id);

            var tripView = new TripDTO
            {
                DepatureTime = trip.DepatureTime,
                TripPrice = trip.TripPrice,
            };

            if (tripView == null)
            {
                return HttpNotFound();
            }
            return View(tripView);
        }
        public Models.Trip UpdateTrip(TripDTO tripTDO)
        {
            var trip = new Trip
            {
                TripId = tripTDO.TripId,
                DepatureTime = tripTDO.DepatureTime,
                TripPrice = tripTDO.TripPrice,
            };

            return trip;
        }
        public Models.Trip CreateTrip(TripDTO tripDTO) // from Trip to TripDTO
        {
            var trip = new Trip
            {
                DepatureTime = tripDTO.DepatureTime,
                TripPrice = tripDTO.TripPrice,           
            };

            return trip;
        }
 public ActionResult Edit(TripDTO tripDTO)
 {
     Trip trip = repository.UpdateTrip(tripDTO);
     if (ModelState.IsValid)
     {
         db.Entry(trip).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(trip);
 }