public ActionResult Edit(EditViewModel editViewModel)
        {
            if (editViewModel == null)
            {
                throw new HttpException(400, "Bad Request");
            }

            var cruise = CruiseService.FindById(editViewModel.CruiseId);
            if (cruise == null)
            {
                throw new HttpException(404, "Not Found");
            }

            cruise.Name = editViewModel.Name;
            cruise.Description = editViewModel.Description;
            cruise.CruiseNumerous = editViewModel.CruiseNumerous;
            cruise.CruiseCode = editViewModel.CruiseCode;

            var trips = new List<Trip>();
            for (var i = 0; i < editViewModel.Table_CheckBox_Trips_Property.Count(); i++)
            {
                if (editViewModel.Table_CheckBox_Trips_Property.ToArray()[i].Selected)
                {
                    trips.Add(TripService.FindById(editViewModel.Table_CheckBox_Trips_Property.ToArray()[i].Id));
                }
            }
            cruise.Trips = trips;

            CruiseService.UpdateCruise(cruise);

            TempData["CruiseId"] = cruise.CruiseId;
            TempData["CruiseName"] = cruise.Name;
            TempData["Message"] = CruisesMessage.EditSuccess;
            return RedirectToAction("index", "cruises");
        }
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                throw new HttpException(400, "Bad Request");
            }

            var cruise = CruiseService.FindById(id.Value);
            if (cruise == null)
            {
                throw new HttpException(404, "Not Found");
            }

            var trips = TripService.GetTrips().ToList();
            var table_CheckBox_Trips_Property = new List<EditViewModel.Table_CheckBox_Trip>();
            for (var i = 0; i < trips.Count(); i++)
            {
                var table_CheckBox_Trip = new EditViewModel.Table_CheckBox_Trip()
                {
                    Id = trips[i].TripId,
                    Name = trips[i].Name,
                    Description = trips[i].Description,
                    Selected = cruise.Trips != null ? cruise.Trips.Any(t => t.TripId == trips[i].TripId) : false
                };
                table_CheckBox_Trips_Property.Add(table_CheckBox_Trip);
            }

            var editViewModel = new EditViewModel()
            {
                CruiseId = cruise.CruiseId,
                Name = cruise.Name,
                Description = cruise.Description,
                CruiseCode = cruise.CruiseCode,
                CruiseNumerous = cruise.CruiseNumerous,
                Table_CheckBox_Trips_Property = table_CheckBox_Trips_Property.ToArray()
            };
            return View(editViewModel);
        }