public async Task RequestAsync(TvShow tvShow, AllTvSeasons selectedSeason) { await _userInterface.DisplayTvShowDetailsAsync(tvShow); var wasRequested = await _userInterface.GetTvShowRequestConfirmationAsync(selectedSeason); if (wasRequested) { var result = await _requester.RequestTvShowAsync(_user, tvShow, selectedSeason); if (result.WasDenied) { await _userInterface.DisplayRequestDeniedForSeasonAsync(selectedSeason); } else { await _userInterface.DisplayRequestSuccessForSeasonAsync(selectedSeason); foreach (var season in tvShow.Seasons.OfType <NormalTvSeason>().Where(x => !x.IsAvailable)) { await _tvShowNotificationWorkflow.NotifyForNewRequestAsync(_user.UserId, tvShow, season); } } } }
public async Task AddNotificationAsync(string userId, int theTvDbId, string seasonType, int seasonNumber) { TvSeason selectedSeason; var tvShow = await _tvShowSearcher.GetTvShowDetailsAsync(new TvShowRequest(null, int.MinValue), theTvDbId); switch (seasonType.ToLower()) { case "f": selectedSeason = new FutureTvSeasons { SeasonNumber = seasonNumber }; break; case "a": selectedSeason = new AllTvSeasons { SeasonNumber = seasonNumber }; break; case "n": selectedSeason = new NormalTvSeason { SeasonNumber = seasonNumber }; break; default: throw new Exception($"Could not handle season of type \"{seasonType}\" when adding notifications"); } _notificationsRepository.AddSeasonNotification(userId, theTvDbId, selectedSeason); await _userInterface.DisplayNotificationSuccessForSeasonAsync(tvShow, selectedSeason); }
public async Task HandleSelectionAsync(TvShowRequest request, TvShow tvShow, AllTvSeasons selectedSeason) { if (tvShow.AllSeasonsFullyRequested()) { await _userInterface.WarnAlreadySeasonAlreadyRequestedAsync(tvShow, new FutureTvSeasons()); } else { await _userInterface.DisplayTvShowDetailsForSeasonAsync(request, tvShow, selectedSeason); } }
public async Task HandleRequestAsync(TvShow tvShow, AllTvSeasons selectedSeason) { await _userInterface.DisplayTvShowDetailsAsync(tvShow); var wasRequested = await _userInterface.GetTvShowRequestConfirmation(selectedSeason); if (wasRequested) { await _requester.RequestTvShowAsync(_user.Username, tvShow, selectedSeason); foreach (var season in tvShow.Seasons.OfType <NormalTvSeason>().Where(x => !x.IsAvailable)) { _notificationRequestRepository.AddSeasonNotification(_user.UserId, tvShow.TheTvDbId, season); } await _userInterface.DisplayRequestSuccessForSeasonAsync(selectedSeason); } }