Exemplo n.º 1
0
        public async Task CreatePlaylist(Playlist playlist, int userId)
        {
            var user = await _identityRepository.GetUser(userId);

            playlist.Owner = user ?? throw new TypedException(ExceptionType.BadRequest);
            await _playlistRepository.CreatePlaylist(playlist, userId);
        }
        public void CreatePlaylist(Playlist playlist)
        {
            if (playlist.IsPlaylistTooBig())
            {
                throw new Exception("Too Big");
            }

            _playlistRepository.CreatePlaylist(playlist);
        }
Exemplo n.º 3
0
        public async Task <bool> CreatePlaylist(PlaylistCreateDTO dto)
        {
            var rao = _mapper.Map <PlaylistCreateRAO>(dto);

            if (await _repository.CreatePlaylist(rao))
            {
                return(true);
            }

            throw new NotImplementedException();
        }
Exemplo n.º 4
0
        public Playlist CreatePlaylistForUser(string name, string description, string key, int maxVotesPerUser, bool active, string imageUrl, User createdBy)
        {
            if (maxVotesPerUser.Equals(null))
            {
                maxVotesPerUser = -1;
            }
            var playlist = new Playlist
            {
                Name                = name,
                Description         = description,
                Key                 = key,
                MaximumVotesPerUser = maxVotesPerUser,
                Active              = active,
                ImageUrl            = imageUrl,
                CreatedById         = createdBy.Id,
                ChatComments        = new List <Comment>(),
                Comments            = new List <Comment>(),
                PlaylistTracks      = new List <PlaylistTrack>()
            };

            return(repo.CreatePlaylist(playlist));
        }
Exemplo n.º 5
0
        //maakt een playlist aan aan de hand van de gegeven data
        public async Task <PlaylistDTO> CreatePlaylist(string playlistname, int limit, string artistid, string token, double[] answers)
        {
            var respone = await _playlistAccess.CreatePlaylist(limit, artistid, token, answers);

            playlist             = new Playlist();
            playlist.Name        = playlistname;
            playlist.Description = "New playlist, made with playlist generator";
            foreach (var trackdto in respone.tracks)
            {
                Track track = new Track {
                    Id  = trackdto.id,
                    Uri = trackdto.uri
                };
                playlist.Tracks.Add(track);
            }
            return(respone);
        }