Пример #1
0
        public Arguments.Base.Response DeletePlayList(Guid idPlayList)
        {
            bool existe = _repositoryVideo.ThereIsAssociatedPlayList(idPlayList);

            if (existe)
            {
                AddNotification("PlayList", MSG.NAO_E_POSSIVEL_EXCLUIR_UMA_X0_ASSOCIADA_A_UMA_X1.ToFormat("Playlist", "vídeo"));
                return(null);
            }

            PlayList playList = _repositoryPlayList.Get(idPlayList);

            if (playList == null)
            {
                AddNotification("PlayList", MSG.DADOS_NAO_ENCONTRADOS);
            }

            if (this.IsInvalid())
            {
                return(null);
            }

            _repositoryPlayList.Delete(playList);

            return(new Response()
            {
                Message = MSG.OPERACAO_REALIZADA_COM_SUCESSO
            });
        }
Пример #2
0
        public AddVideoResponse AddVideo(AddVideoRequest request, Guid idUser)
        {
            if (request == null)
            {
                AddNotification("AdicionarVideoRequest", MSG.OBJETO_X0_E_OBRIGATORIO.ToFormat("AdicionarVideoRequest"));
                return(null);
            }

            User user = _repositoryUser.Get(idUser);

            if (user == null)
            {
                AddNotification("User", MSG.X0_NAO_INFORMADO.ToFormat("Usuário"));
                return(null);
            }

            Channel channel = _repositoryChannel.Get(request.IdChannel);

            if (channel == null)
            {
                AddNotification("Canal", MSG.X0_NAO_INFORMADO.ToFormat("Canal"));
                return(null);
            }

            PlayList playList = null;

            if (request.IdPlayList != Guid.Empty)
            {
                playList = _repositoryPlayList.Get(request.IdPlayList);
                if (playList == null)
                {
                    AddNotification("PlayList", MSG.X0_NAO_INFORMADA.ToFormat("playList"));
                    return(null);
                }
            }

            var video = new Video(channel, playList, request.Title, request.Description, request.Tags, request.OrderPlayList, request.IdVideoYoutube, user);

            AddNotifications(video);

            if (this.IsInvalid())
            {
                return(null);
            }

            _repositoryVideo.Add(video);

            return(new AddVideoResponse(video.Id));
        }