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 RentalsVM getRentalsVM()
        {
            if (_rentalsVM == null)
            {
                _rentalsVM = new RentalsVM(_dataContext);
            }

            return _rentalsVM;
        }
        /// <summary>
        /// loob laenutuste vaatemudeli
        /// </summary>
        /// <returns></returns>
        private RentalsVM getRentalsVM()
        {
            if (_rentalsVM == null)
            {
                _rentalsVM = new RentalsVM();
            }

            return _rentalsVM;
        }
        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");
        }