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); } }
private async Task HandleMovieSelectionAsync(Movie movie) { await _userInterface.DisplayMovieDetails(movie); if (CanBeRequested(movie)) { var isRequested = await _userInterface.GetMovieRequestAsync(); if (isRequested) { await _requester.RequestMovieAsync(_user.Username, movie); await _userInterface.DisplayRequestSuccess(movie); _notificationRequestRepository.AddNotification(_user.UserId, int.Parse(movie.TheMovieDbId)); } } else { if (movie.Available) { await _userInterface.WarnMovieAlreadyAvailable(); } else if (IsAlreadyNotified(movie)) { await _userInterface.WarnMovieUnavailableAndAlreadyHasNotification(); } else { var isRequested = await _userInterface.AskForNotificationRequestAsync(); if (isRequested) { _notificationRequestRepository.AddNotification(_user.UserId, int.Parse(movie.TheMovieDbId)); await _userInterface.DisplayNotificationSuccessAsync(movie); } } } }
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); } } }