Beispiel #1
0
        /// <inheritdoc cref="IMovieBase.AddMovie(string, int, string)"/>
        public Movie AddMovie(string movieName, int durationMinutes, string genre)
        {
            Validator.ValidateMovieDuration(durationMinutes);
            Validator.ValidateTextualInput(movieName, genre);


            if (MovieExists(movieName))
            {
                throw new DuplicateKeyException(movieName, $"Movie with name {movieName} already exists!");
            }

            Movie newMovie = _movieDao.Create(movieName, durationMinutes, genre);

            _movieCache[newMovie.Name] = newMovie;

            return(newMovie);
        }