//
        // GET: /Ferry/

        public ActionResult Index()
        {
            var viewFerry = new FerryDTO
            {
                FerryList = repository.GetAllFerries(),
            };
            return View(viewFerry);
        }
        public ActionResult Create(FerryDTO ferryDTO)
        {
           var ferry = repository.CreateFerry(ferryDTO);

            if (ModelState.IsValid)
            {
                db.Ferrys.Add(ferry);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View("Index");
        }
        //
        // GET: /Ferry/Details/5

        public ActionResult Details(int id)
        {
            var ferry = repository.GetFerry(id);

            var ferryView = new FerryDTO
            {
                FerryName = ferry.FerryName,
                FerrySize = ferry.FerrySize,
                PassengerCapacity = ferry.PassengerCapacity,
                VehicleCapacity = ferry.VehicleCapacity,
                Municipality = ferry.Municipality,
                DockId = ferry.DockId,
            };

            if (ferryView == null)
            {
                return HttpNotFound();
            }
            return View(ferryView);
        }
        public Models.Ferry UpdateFerry(FerryDTO ferryDTO)
        {
            var ferry = new Ferry
            {
                FerryId = ferryDTO.FerryId,
                FerryName = ferryDTO.FerryName,
                FerrySize = ferryDTO.FerrySize,
                PassengerCapacity = ferryDTO.PassengerCapacity,
                VehicleCapacity = ferryDTO.VehicleCapacity,
                Municipality = ferryDTO.Municipality,
                DockId = ferryDTO.DockId,
            };

            return ferry;
        }
 public ActionResult Edit(FerryDTO ferryDTO)
 {
     var ferry = repository.UpdateFerry(ferryDTO);
     if (ModelState.IsValid)
     {
         db.Entry(ferry).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(ferry);
 }