Exemplo n.º 1
0
 private async Task HandleMovieSelectionAsync(Movie movie)
 {
     if (CanBeRequested(movie))
     {
         await _userInterface.DisplayMovieDetailsAsync(new MovieRequest(_user, _categoryId), movie);
     }
     else
     {
         if (movie.Available)
         {
             await _userInterface.WarnMovieAlreadyAvailableAsync(movie);
         }
         else
         {
             await _notificationWorkflow.NotifyForExistingRequestAsync(_user.UserId, movie);
         }
     }
 }
Exemplo 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);
                }
            }
        }