private void BuyCD(long movieId) { Maybe <Movie> movieOrNothing = _repository.GetOne(movieId); if (movieOrNothing.HasNoValue) { return; } Movie movie = movieOrNothing.Value; var spec = new AvailableOnCDSpecification(); if (!spec.IsSatisfiedBy(movie)) { MessageBox.Show("The movie doesn't have a CD version", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } MessageBox.Show("You've bought a ticket", "Success", MessageBoxButton.OK, MessageBoxImage.Information); }
private void BuyCD(long movieId) { Maybe <Movie> movieOrNothing = _repository.GetOne(movieId); if (movieOrNothing.HasNoValue) { return; } Movie movie = movieOrNothing.Value; //var specification = new GenericSpesification<Movie>(m => m.ReleaseDate <= DateTime.Now.AddMonths(-6)); var specification = new AvailableOnCDSpecification(); if (!specification.IsSatisfiedBy(movie)) { MessageBox.Show("The movie doesn't have a CD version", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } MessageBox.Show("You've bought a ticket", "Success", MessageBoxButton.OK, MessageBoxImage.Information); }