Пример #1
0
        public IActionResult GetPlaylistWithLinks(Guid id)
        {
            var playListEntity = _sprotifyRepository.GetPlaylist(id);

            if (playListEntity == null)
            {
                return(NotFound());
            }

            // return Ok(Mapper.Map<Models.Playlist>(playListEntity));

            // include links
            var mappedPlaylist = Mapper.Map <Models.Playlist>(playListEntity);

            return(Ok(CreateLinks(mappedPlaylist)));
        }
        public IActionResult GetPlaylist(Guid playlistId, [FromQuery] bool expand)
        {
            var playlist = _sprotifyRepository.GetPlaylist(playlistId, expand);

            if (playlist == null)
            {
                return(NotFound());
            }

            if (expand)
            {
                var playlistWithSongsToReturn = Mapper.Map <PlaylistWithSongs>(playlist);
                return(Ok(playlistWithSongsToReturn));
            }

            return(Ok(Mapper.Map <Playlist>(playlist)));
        }