public void AddMovie(Movie movie)
        {
            Debug.Assert(selected != null);

            selected.RentedMovies.Add(movie);

            OnPropertyChanged("Selected");
        }
        private void addMovieButton_Click(object sender, RoutedEventArgs e)
        {
            // Name and desc do not require any special checking.

            string name = AskUserForInformation("Nimi :");
            if (!ValidateNotEmpty(name)) return;

            string description = AskUserForInformation("Kuvaus :");
            if (!ValidateNotEmpty(name)) return;

            // Get date from the user and validate it.
            string releaseDate = AskUserForInformation("Julkaisupäivä :");
            if (!ValidateNotEmpty(name)) return;

            if (!IsValidReleaseDate(releaseDate))
            {
                DisplayError("Virheellinen päivämäärä!");
                return;
            }

            // Get rent price from the user and validate it.
            string rentPricePerDay = AskUserForInformation("Vuokra/päivä:").Replace('.', ',');

            if (!IsValidRentPrice(rentPricePerDay))
            {
                DisplayError("Virheellinen hinta!");
                return;
            }

            // Get format from the user and validate it.
            string format = AskUserForInformation("Formaatti :").ToLower();

            if (!IsValidMovieFormat(format))
            {
                DisplayError("Virheellinen formaatti!");
                return;
            }

            // Create new movie and add it to the "database"
            Movie newMovie = new Movie()
            {
                Name                = name,
                Description         = description,
                ReleaseDate         = releaseDate,
                RentPricePerDay     = float.Parse(rentPricePerDay),
                Format              = ParseFormat(format)
            };

            moviesViewModel.Movies.Add(newMovie);
            movieDatabase.Movies.Add(newMovie);
        }
        private void rentSelectedButton_Click(object sender, RoutedEventArgs e)
        {
            SelectedMovie = moviesListView.SelectedItem as Movie;

            Close();
        }