コード例 #1
0
 public List <Editora> listarEditoras()
 {
     try
     {
         EditoraEF editora = new EditoraEF();
         return(editora.listarEditoras());
     }
     catch (Exception ex)
     {
         throw new Exception("Falha ao buscar editoras. \nErro:" + ex.Message);
     }
 }
コード例 #2
0
        public List <Editora> ListarEditoras()
        {
            try
            {               //estaciar o objeto que se comunica com banco de dados
                EditoraEF editoraEF = new EditoraEF();
                //executa o metodo listar editoras (faz select )
                var ed = editoraEF.ListarEditora();

                return(ed);
            }
            catch (Exception ex)
            {
                throw new Exception("Falha ao tentar Validar a busca das Editoras. Erro:\n" + ex.Message);
            }
        }
コード例 #3
0
        public Editora BuscarEditora(int id)
        {
            EditoraEF editora = new EditoraEF();

            Editora ed;

            try
            {
                ed = editora.BuscarEditora(id);
            }
            catch (Exception ex)
            {
                throw new Exception("Falha ao tentar Validar Busca" + ex.Message);
            }
            return(ed);
        }
コード例 #4
0
        public List <Editora> ListarEditoras()
        {
            try
            {
                EditoraEF editoraEF = new EditoraEF();

                var ed = editoraEF.ListarEditoras();

                return(ed);
            }
            catch (Exception ex)
            {
                throw new Exception("Falha ao tentar Validar a buscar das Editoras. Erro: \n" +
                                    ex.Message);
            }
        }
コード例 #5
0
        public Editora BuscarEditora(int id)
        {
            EditoraEF editoraEF = new EditoraEF();

            Editora ed;

            try
            {
                ed = editoraEF.BuscarEditora(id);
            }
            catch (Exception ex)
            {
                throw new Exception("Falha ao tentar validar a busca das Editoras. Erro : \n" + ex.Message);
            }

            return(ed);
        }
コード例 #6
0
        public Editora BuscarEditora(int id)
        {
            //Instanciando o objeto que se comunica com o banco de dados
            EditoraEF editoraEF = new EditoraEF();

            Editora ed;

            try
            {
                // Executa o metodo listar Editoras (Faz Select)
                ed = editoraEF.BuscarEditora(id);
            }
            catch (Exception ex)
            {
                throw new Exception("Falha ao tentar validar a busca de editoras" + ex.Message);
            }

            return(ed);
        }
コード例 #7
0
 public void Salvar(Editora editora)
 {
     try
     {
         if (string.IsNullOrEmpty(editora.Nome))
         {
             throw new Exception("Nome invalido");
         }
         if (string.IsNullOrEmpty(editora.Email))
         {
             throw new Exception("E-mail invalido");
         }
         EditoraEF editoraEF = new EditoraEF();
         editoraEF.Salvar(editora);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #8
0
 public bool RegistraEditora(Editora editora)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(editora.Nome))
         {
             throw new Exception("Nome precisa ser preenchido");
         }
         if (string.IsNullOrWhiteSpace(editora.Email))
         {
             throw new Exception("Email precisa ser preenchido");
         }
         EditoraEF editoraEF = new EditoraEF();
         return(editoraEF.RegistraEditora(editora));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #9
0
        public List <Editora> ListarEditoras()
        {
            // instanciamos o objeto que se comunica com Banco dados
            EditoraEF editoraEF = new EditoraEF();

            List <Editora> ed;

            try
            {
                // executa o metodo listar Editoras (Faz Select)
                ed = editoraEF.ListarEditoras();
            }
            catch (Exception ex)
            {
                throw new Exception(
                          "Falha ao tentar Validar a busca das Editoras. Erro: \n"
                          + ex.Message);
            }

            return(ed);
        }
コード例 #10
0
        public void Excluir(int id)
        {
            EditoraEF edEF = new EditoraEF();

            edEF.Excluir(id);
        }
コード例 #11
0
        public bool RemoverEditora(int id)
        {
            EditoraEF editoraEF = new EditoraEF();

            return(editoraEF.RemoverEditora(id));
        }
コード例 #12
0
        public bool AlterarEditora(int id, Editora editora)
        {
            EditoraEF editoraEF = new EditoraEF();

            return(editoraEF.AlterarEditora(id, editora));
        }
コード例 #13
0
        public Editora ObterEditora(int id)
        {
            EditoraEF editoraEF = new EditoraEF();

            return(editoraEF.ObterEditora(id));
        }
コード例 #14
0
        public void AlterarEditora(Editora editora)
        {
            EditoraEF editoraEF = new EditoraEF();

            editoraEF.AlterarEditora(editora);
        }
コード例 #15
0
        public void CriarEditora(Editora editora)
        {
            EditoraEF editoraEF = new EditoraEF();

            editoraEF.CriarEditora(editora);
        }
コード例 #16
0
        public Editora BuscarEditora(int id)
        {
            EditoraEF editoraEF = new EditoraEF();

            return(editoraEF.BuscarEditora(id));
        }