Beispiel #1
0
        public async Task <Playlist> CreatePlaylist(Guid userId, string title, bool isPrivate, bool isCollaborative)
        {
            var playlist = new Playlist(userId, title, isPrivate, isCollaborative);

            _playlistRepository.Create(playlist);

            await _unitOfWork.SaveChanges().ConfigureAwait(false);

            return(playlist);
        }
        public void AddTrackToNewPlaylist(int trackId, string playlistName, int userId)
        {
            var user = _playlistRepository.GetById <User>(userId);

            var playlist = _playlistFactory.Produce(playlistName, user);

            playlist.UrlId = _playlistRepository.GenerateUrlId(playlist.Name, userId);

            _playlistRepository.Create(playlist);

            AddTrack(trackId, playlist.Id);
        }