Esempio n. 1
0
        public async Task RequestMovieAsync(int theMovieDbId)
        {
            var movie = await _searcher.SearchMovieAsync(new MovieRequest(_user, _categoryId), theMovieDbId);

            var result = await _requester.RequestMovieAsync(new MovieRequest(_user, _categoryId), movie);

            if (result.WasDenied)
            {
                await _userInterface.DisplayRequestDeniedAsync(movie);
            }
            else
            {
                await _userInterface.DisplayRequestSuccessAsync(movie);

                await _notificationWorkflow.NotifyForNewRequestAsync(_user.UserId, movie);
            }
        }
Esempio n. 2
0
        private async Task HandleMovieSelectionAsync(Movie movie)
        {
            await _userInterface.DisplayMovieDetailsAsync(movie);

            if (CanBeRequested(movie))
            {
                var wasRequested = await _userInterface.GetMovieRequestAsync(movie);

                if (wasRequested)
                {
                    var result = await _requester.RequestMovieAsync(_user, movie);

                    if (result.WasDenied)
                    {
                        await _userInterface.DisplayRequestDeniedAsync(movie);
                    }
                    else
                    {
                        await _userInterface.DisplayRequestSuccessAsync(movie);

                        await _notificationWorkflow.NotifyForNewRequestAsync(_user.UserId, movie);
                    }
                }
            }
            else
            {
                if (movie.Available)
                {
                    await _userInterface.WarnMovieAlreadyAvailableAsync();
                }
                else
                {
                    await _notificationWorkflow.NotifyForExistingRequestAsync(_user.UserId, movie);
                }
            }
        }