示例#1
0
        public async Task <IActionResult> CreatePlaylist(SubsonicRequest request, string playlistId, string name,
                                                         string[] songId)
        {
            var authResult = await AuthenticateUser(request).ConfigureAwait(false);

            if (authResult != null)
            {
                return(authResult);
            }
            var result = await SubsonicService.CreatePlaylist(request, SubsonicUser, name, songId, playlistId).ConfigureAwait(false);

            return(BuildResponse(request, result, "playlist"));
        }
        public async Task Save()
        {
            CanEdit = false;
            var existingEntry = MenuItems.FirstOrDefault(item => item.Item.Name == PlaylistName);

            if (existingEntry != null)
            {
                await
                SubsonicService.GetPlaylist(existingEntry.Item.Id)
                .WithErrorHandler(ErrorHandler)
                .OnSuccess(async result => await UpdatePlaylist(result))
                .Execute();
            }
            else
            {
                var songIds = GetSongIdsForActivePlaylist();
                await
                SubsonicService.CreatePlaylist(PlaylistName, songIds)
                .WithErrorHandler(ErrorHandler)
                .OnSuccess(OnSaveFinished)
                .Execute();
            }
        }