Beispiel #1
0
        public async Task <IActionResult> GetWatchlist(int page = 1, int pageSize = 5)
        {
            var count = await _filmReader.GetUnwatchedFilmCount(_currentUserAccessor.CurrentUser.Id);

            var records = await _watchlistReader.GetWatchlist(_currentUserAccessor.CurrentUser.Id, pageSize, (page - 1) *pageSize);

            return(Ok(PagedResponse <FilmResponse> .FromEnumerable(records, record => FilmResponse.FromRecord(record), page, pageSize, count)));
        }
        private async Task <bool> UserHasUnwatchedFilms(string userId, CancellationToken cancellationToken)
        {
            var unwatchedFilmCount = await _filmReader.GetUnwatchedFilmCount(userId);

            return(unwatchedFilmCount > 0);
        }