示例#1
0
        public Response ExcluirPlayList(Guid idPlayList)
        {
            // bool existe =_repositorioVideo.ExistePlayListAssociado(idPlayList)
            bool existe = false;

            if (existe)
            {
                AddNotification("PlayList", "Não é possível excluir uma playlist associada a um vídeo");
                return(null);
            }

            PlayList playList = _repositorioPlayList.Obter(idPlayList);

            if (playList == null)
            {
                AddNotification("PlayList", "Dados não encontrados");
            }

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

            _repositorioPlayList.Excluir(playList);

            return(new Response()
            {
                Message = "Operação realizada com sucesso",
            });
        }
示例#2
0
        public Response ExcluirPlayList(Guid idPlayList)
        {
            // bool existe _respositoryVideo.ExistePlayListAssociado(idPlayList);
            bool existe = false;

            if (existe)
            {
                AddNotification("PlayList", MSG.NAO_E_POSSIVEL_EXCLUIR_UMA_X0_ASSOCIADA_A_UMA_X1.ToFormat("PlayList", "Video"));
                return(null);
            }

            PlayList playList = _repositoryPlayList.Obter(idPlayList);

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

            _repositoryPlayList.Excluir(playList);

            return(new Response()
            {
                Message = MSG.OPERACAO_REAIZADA_COM_SUCESSO
            });
        }
        public Response Delete(Guid idPlayList)
        {
            bool exist = _repositoryVideo.ExistePlayListAssociada(idPlayList);

            if (exist)
            {
                AddNotification("PlayList", Msg.NAO_E_POSSIVEL_EXCLUIR_UMA_X0_ASSOCIADA_A_UM_X1.ToFormat("PlayList", "Video"));
                return(null);
            }

            PlayList playList = _repositoryPlayList.Obter(idPlayList);

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

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

            _repositoryPlayList.Delete(playList);

            return(new Response()
            {
                Mensagem = Msg.OPERACAO_REALIZADA_COM_SUCESSO
            });
        }
        public ResponseBase Excluir(Guid id)
        {
            if (id == null)
            {
                AddNotification("IdPlayList", MSG.X0_E_OBRIGATORIO.ToFormat("IdPlayList"));
                return(null);
            }

            var playListExcluir = _repositoryPlayList.Obter(id);

            if (playListExcluir == null)
            {
                AddNotification("PlayList", MSG.X0_INVALIDO.ToFormat("IdPlayList"));
                return(null);
            }

            bool existeVideoRelacionado = _repositoryVideo.ExistePlayListAssociado(id);

            if (existeVideoRelacionado)
            {
                AddNotification("PlayList", MSG.NAO_E_POSSIVEL_EXCLUIR_UMA_X0_ASSOCIADA_A_UMA_X1.ToFormat("PlayList", "Video"));
                return(null);
            }

            _repositoryPlayList.Excluir(id);

            return(new ResponseBase()
            {
                Mensagem = MSG.OPERACAO_REALIZADA_COM_SUCESSO
            });
        }
示例#5
0
        public Arguments.Base.Response ExcluirPlayList(Guid idPlayList)
        {
            //bool existe _repositoryVideo.ExistePlayListAssociada(idPlayList);
            bool existe = false;

            if (existe)
            {
                AddNotification("PlayList", "Não é possivel exvluir uma PlayList associada");
                return(null);
            }

            PlayList playList = _repositoryPlayList.Obter(idPlayList);

            if (playList == null)
            {
                AddNotification("PlayList", "Dados não encontrados");
            }

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

            _repositoryPlayList.Excluir(playList);

            return(new Response()
            {
                Message = "Operação realizada com sucesso"
            });
        }
示例#6
0
        public Arguments.Base.Response ExcluirPlayList(Guid id)
        {
            bool existe = _repositoryVideo.ExistePlayListAssociada(id);

            if (existe)
            {
                AddNotification("PlayList", MSG.NAO_E_POSSIVEL_EXCLUIR_UMA_X0_ASSOCIADA_A_UMA_X1.ToFormat("PlayList", "Video"));
                return(null);
            }
            PlayList playlist = _repositoryPlayList.Obter(id);

            if (playlist == null)
            {
                AddNotification("PlayList", MSG.DADOS_NAO_ENCONTRADOS);
            }
            if (IsInvalid())
            {
                return(null);
            }

            _repositoryPlayList.Excluir(playlist);
            return(new Arguments.Base.Response {
                Message = MSG.OPERACAO_REALIZADA_COM_SUCESSO
            });
        }
示例#7
0
        public AdicionarVideoResponse AdicionarVideo(AdicionarVideoRequest request, Guid idUsuario)
        {
            if (request == null)
            {
                AddNotification("AdicionarVideoRequest", MSG.OBJETO_X0_E_OBRIGATORIO.ToFormat("AdicionarVideoRequest"));
                return(null);
            }

            Usuario usuario = _repositoryUsuario.Obter(idUsuario);

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

            Canal canal = _repositoryCanal.Obter(request.IdCanal);

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

            PlayList playList = null;

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

            var video = new Video(canal, playList, request.Titulo, request.Descricao, request.Tags, request.OrdemNaPlayList, request.IdVideoYoutube, usuario);

            AddNotifications(video);

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

            _repositoryVideo.Adicionar(video);

            return(new AdicionarVideoResponse(video.Id));
        }
示例#8
0
        public AdicionarVideoResponse AdicionarVideo(AdicionarVideoRequest request, Guid idUsuario)
        {
            if (request == null)
            {
                AddNotification("Video", "Objeto AdicionarVideoRequest é obrigatório");
                return(null);
            }

            Usuario usuario = _repositoryUsuario.Obter(idUsuario);

            if (usuario == null)
            {
                AddNotification("Usuário", "Objeto Usuário não encontrado");
                return(null);
            }
            Canal canal = _repositoryCanal.Obter(request.IdCanal);

            if (canal == null)
            {
                AddNotification("Canal", "Objeto Canal não encontrado");
                return(null);
            }

            PlayList playList = null;

            if (request.IdPlayList != Guid.Empty)
            {
                playList = _repositoryPlayList.Obter(request.IdPlayList);

                if (playList == null)
                {
                    AddNotification("PlayList", "Objeto Playlist não encontrado");
                    return(null);
                }
            }

            var video = new Video(canal, playList, request.Titulo, request.Descricao, request.Tags, request.OrdemNaPlayList, request.IdVideoYoutube, usuario);

            AddNotifications(video);

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

            _repositoryVideo.Adicionar(video);

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