Ejemplo n.º 1
0
        public async Task <IActionResult> AddSong(int pPlaylistId, string pSongGuid)
        {
            if (pPlaylistId <= 0)
            {
                return(BadRequest());
            }

            if (String.IsNullOrEmpty(pSongGuid))
            {
                return(BadRequest());
            }


            AbstractSongDto video;

            video = await _youtubeSearch.GetByYoutubeId(pSongGuid);


            AbstractSongDto song = new PlaylistSongDto();

            if (video != null)
            {
                song.YouTubeId  = pSongGuid;
                song.PlaylistId = pPlaylistId;
                song.Artist     = video.Artist;
                song.Name       = video.Name;
                song.UserId     = SessionState.GetCurrUserID(User);

                song.Id = await _playlistSongEntity.Add(song);
            }

            return(Ok(song));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Song(string songId)
        {
            if (String.IsNullOrEmpty(songId))
            {
                return(View(new UnknownSongDto()));
            }

            AbstractSongDto song;

            song = await _youtubeSearch.GetByYoutubeId(songId);

            return(View(song));
        }