예제 #1
0
        public async Task <NowPlaying> PlayNextAsync()
        {
            if (_context.Player.Video != null)
            {
                await _historyRepository.AddAsync(_context.Player.Video, _context).ConfigureAwait(false);

                _context.Player.Video     = null;
                _context.Player.IsPlaying = false;
                await _context.SaveChangesAsync().ConfigureAwait(false);
            }

            var first = await _currentPlaylistRepository.GetFirstAsync().ConfigureAwait(false);

            if (first == null)
            {
                return(_context.Player);
            }

            var nowPlaying = await PlayNowPrivateAsync(first.Video, false).ConfigureAwait(false);

            await _currentPlaylistRepository.RemoveAsync(first.Id, _context).ConfigureAwait(false);

            await _context.SaveChangesAsync().ConfigureAwait(false);

            return(nowPlaying);
        }
예제 #2
0
 public Task RemoveAsync(int id)
 {
     return(_currentPlaylistRepository.RemoveAsync(id));
 }