public NewMovieWindow(MoviesVM moviesVM)
        {
            InitializeComponent();

            _moviesVM = moviesVM;
            _movie = new Movie();
            this.DataContext = _movie;
        }
        public NewMovieWindow(MoviesVM moviesVM, DBA.Movie movie)
        {
            InitializeComponent();
            this._moviesVM = moviesVM;
            this._movie = movie;

            this.DataContext = movie;
        }
        internal void createSampleData(bool isFullDataNeeded)
        {
            if (isFullDataNeeded)
            {
                ClientVM _clientVM = new ClientVM(_dataContext);
                _clientVM.createSampleClients();

                MoviesVM _moviesVM = new MoviesVM(_dataContext);
                _moviesVM.createSampleMovies();
            }

            UserVM _userVM = new UserVM(_dataContext);
            _userVM.createDefaultUser();
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            _clientVM = null;
            _moviesVM = null;
            _rentalsVM = null;

            if (_dataContext.DatabaseExists())
            {
                MessageBox.Show("Database olemas, kustutan");
                _dataContext.DeleteDatabase();
            }

            _dataContext.CreateDatabase();
            MessageBox.Show("Uus baas genereeritud");
        }
        public AddRentalWindow(RentalsVM rentalsVM, ClientVM clientVM, MoviesVM moviesVM, DBA.Rental rental)
        {
            InitializeComponent();

            this._rentalsVM = rentalsVM;
            this._clientVM = clientVM;
            this._moviesVM = moviesVM;
            this._rental = rental;

            cboxClient.ItemsSource = _clientVM.getClients();
            listBoxMovies.ItemsSource = _moviesVM.getMovies();

            InitializeComponent();
            _rental = rental;
            this.DataContext = _rental;
        }
        public AddRentalWindow(RentalsVM rentalVM, ClientVM clientVM, MoviesVM moviesVM)
        {
            InitializeComponent();
            _rental = new DBA.Rental();
            this.DataContext = _rental;

            _rentalsVM = rentalVM;
            _clientVM = clientVM;
            _moviesVM = moviesVM;

            cboxClient.ItemsSource = _clientVM.getClients();
            listBoxMovies.ItemsSource = _moviesVM.getMovies();

            _rental.StartDate = DateTime.Now;
            _rental.EndDate = DateTime.Now.AddDays(7d);
        }
        private MoviesVM getMoviesVM()
        {
            if (_moviesVM == null)
            {
                _moviesVM = new MoviesVM(_dataContext);
            }

            return _moviesVM;
        }
        /// <summary>
        /// loob filmi vaatemudeli
        /// </summary>
        /// <returns></returns>
        private MoviesVM getMoviesVM()
        {
            if (_moviesVM == null)
            {
                _moviesVM = new MoviesVM();
            }

            return _moviesVM;
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            _clientVM = null;
            _moviesVM = null;
            _rentalsVM = null;
            _userVM = null;

            if (_dataContext.DatabaseExists())
            {
                MessageBox.Show("Database olemas, kustutan");
                _dataContext.DeleteDatabase();
            }

            _dataContext.CreateDatabase();

            getUserVM().createDefaultUser();
            getClientVM().createSampleClients();
            getMoviesVM().createSampleMovies();

            MessageBox.Show("Uus baas genereeritud koos test andmetega genereeritud");
        }