//
        // GET: /Dock/

        public ActionResult Index()
        {
            var viewDock = new DockDTO
            {
                DockList = repository.GetAllDocks(),
            };
            return View(viewDock);
        }
        public ActionResult Create(DockDTO dockDTO)
        {
            var dock = repository.CreateDock(dockDTO);
            if (ModelState.IsValid)
            {
                db.Docks.Add(dock);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(dock);
        }
        //
        // GET: /Dock/Details/5

        public ActionResult Details(int id )
        {
            //Dock dock = db.Docks.Find(id);
            var dock = repository.GetDock(id);  // .DockDetail(id);
            //Customer customer = db.Customers.Find(id);
            var dockView = new DockDTO
            {
                DockName = dock.DockName,
                FerryCapacity = dock.FerryCapacity,
            };

            if (dockView == null)
            {
                return HttpNotFound();
            }
            return View(dockView);
        }
        public Models.Dock CreateDock(DockDTO dockDTO)
        {
            var dock = new Dock
            {
               DockName = dockDTO.DockName,
               FerryCapacity= dockDTO.FerryCapacity,
            };

            return dock;
        }
        //
        // GET: /Dock/Edit/5

        public ActionResult Edit(int id)
        {
            var dock = repository.GetDock(id);
            var dockView = new DockDTO
            {
                DockId = dock.DockId,
                DockName = dock.DockName,
                FerryCapacity = dock.FerryCapacity,

            };
            if (dock == null)
            {
                return HttpNotFound();
            }
            return View(dock);
        }
        public ActionResult Edit(DockDTO dockDTO) // same as update dock
        {
            var dock = new Dock
            {
                 DockId = dockDTO.DockId,
                 DockName  = dockDTO.DockName,
                 FerryCapacity = dockDTO.FerryCapacity,
            };

            if (ModelState.IsValid)
            {
                db.Entry(dock).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(dock);
        }