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 }); }