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); }
public async Task <bool> CreatePlaylist(PlaylistCreateDTO dto) { var rao = _mapper.Map <PlaylistCreateRAO>(dto); if (await _repository.CreatePlaylist(rao)) { return(true); } throw new NotImplementedException(); }
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)); }
//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); }