private bool EditFlight(FlightModel flight)
        {
            var editWindow = new EditFlightWindow();
            var ctx        = (EditFlightViewModel)editWindow.DataContext;
            var flightCopy = new FlightModel();

            CopyFields(flight, flightCopy);
            ctx.Flight            = flightCopy;
            ctx.Routes            = _routeService.GetAllRoutes();
            ctx.Airplanes         = _airplaneService.GetAllAirplanes();
            flightCopy.RouteModel = ctx.Routes.Single(r => r.Id == flightCopy.RouteModel.Id);
            if (editWindow.ShowDialog() != true)
            {
                return(false);
            }

            var errs = GetModelErrors(flightCopy);

            if (errs != string.Empty)
            {
                ShowError(errs, "Error! Saving cancelled. ");
                return(false);
            }

            CopyFields(flightCopy, flight);
            _flightService.EditFlight(flight);
            return(true);
        }
        private bool AddFlight(FlightModel flightModel)
        {
            var editWindow = new EditFlightWindow();
            var ctx        = (EditFlightViewModel)editWindow.DataContext;

            ctx.Flight    = flightModel;
            ctx.Routes    = _routeService.GetAllRoutes();
            ctx.Airplanes = _airplaneService.GetAllAirplanes();
            if (editWindow.ShowDialog() != true)
            {
                return(false);
            }

            var errs = GetModelErrors(ctx.Flight);

            if (errs != string.Empty)
            {
                ShowError(errs, "Error! Saving cancelled. ");
                return(false);
            }

            _flightService.AddFlight(flightModel);
            return(true);
        }