// public  event EventHandler RefreshCompleated  ;

        public PlayListDetailViewModel(INetWorkServices netWorkServices, PlayPartCore playPart)
        {
            this._netWorkServices = netWorkServices;
            _playPart             = playPart;
            _innerPlayList        = new PlayListDetail();
            PlayAllCommand        = new DelegateCommand(PlayAllCommandExecute);
            this.SelectedCommand  = new DelegateCommand <IEnumerable>(SelectedCommandExecute);
        }
        public async Task <IActionResult> UpdatePlayList(PlayListDetail playListDetail)
        {
            var result = await _playListServices.UpdatePlayListDetailAsync(playListDetail);

            if (result.IsSuccess)
            {
                return(Ok(result));
            }

            return(BadRequest());
        }
        /// <summary>
        /// 设置当前的播放列表id
        /// </summary>
        /// <param name="id"></param>
        protected override async void SetById(long id)
        {
            Console.WriteLine(id);
            var netWorkDataResult = await this._netWorkServices.GetAsync <PlayListDetail>("Common", "GetPlaylistById", new { id });

            if (netWorkDataResult.Successed)
            {
                var model = netWorkDataResult.Data;
                this._innerPlayList = model;
                _tracks             = null;//更新数据
                OnSearchKeyWordChanged();
                RaiseAllPropertyChanged();
            }
            else
            {
                //todo 网络连接失败
            }
        }
Beispiel #4
0
        public async Task <OperationResponse <PlayListDetail> > UpdatePlayListDetailAsync(PlayListDetail playListDetail)
        {
            var playList = await _unitOfWork.PlayList.GetPLayListByIdAsync(playListDetail.Id);

            if (playList == null)
            {
                return(new OperationResponse <PlayListDetail>
                {
                    IsSuccess = false,
                    Data = null,
                    Message = "PlayList not found!",
                });
            }

            playList.Name        = playListDetail.Name;
            playList.Description = playListDetail.Description;

            await _unitOfWork.CommitChangesAsync(_identityOptions.UserId);

            return(new OperationResponse <PlayListDetail>
            {
                IsSuccess = true,
                Message = "Playlist has been Update Successfully!",
                Data = playListDetail,
            });
        }
Beispiel #5
0
        public async Task <OperationResponse <PlayListDetail> > CreatePlayListDetailAsync(PlayListDetail playListDetail)
        {
            PlayList playList = new PlayList
            {
                Name        = playListDetail.Name,
                Description = playListDetail.Description,
            };

            await _unitOfWork.PlayList.CreatePlayListAsync(playList);

            await _unitOfWork.CommitChangesAsync(_identityOptions.UserId);

            playListDetail.Id = playList.Id;

            return(new OperationResponse <PlayListDetail>
            {
                IsSuccess = true,
                Message = "PlayList created Successfully!",
                Data = playListDetail,
            });
        }