Ejemplo n.º 1
0
 public override string Processar(EntidadeDominio entidade)
 {
     try
     {
         Livro    liv  = (Livro)entidade;
         AutorDAO forn = new AutorDAO();
         for (int i = 0; i < liv.Autores.Count; i++)
         {
             Autor endereco = liv.Autores[i];
             List <EntidadeDominio> ende = forn.Consultar(endereco);
             if (ende.Count > 0)
             {
                 liv.Autores[i] = (Autor)ende.ElementAt(0);
             }
             else
             {
                 forn.Salvar(liv.Autores[i]);
                 ende           = forn.Consultar(liv.Autores[i]);
                 liv.Autores[i] = (Autor)ende.ElementAt(0);
             }
         }
         return(null);
     }
     catch (Exception e) {
         return(e.Message);
     }
 }
Ejemplo n.º 2
0
        public override string Processar(EntidadeDominio entidade)
        {
            AutorDAO Adao = new AutorDAO();

            LivroDAO lDAO = new LivroDAO();

            throw new NotImplementedException();
        }
Ejemplo n.º 3
0
        public void UpdateAutor(Autor autor)
        {
            AutorDAO autorDAO = new AutorDAO();

            if (autor.Nome != "")
            {
                autorDAO.Update(autor);
            }
        }
Ejemplo n.º 4
0
        public void DeletarAutor(Autor autor)
        {
            AutorDAO autorDAO = new AutorDAO();

            if (autor.AutorId != 0)
            {
                autorDAO.delete(autor);
            }
        }
Ejemplo n.º 5
0
        public void InserirAutor(Autor autor)
        {
            AutorDAO autorDAO = new AutorDAO();

            if (autor.Nome != "")
            {
                autorDAO.Insert(autor);
            }
        }
Ejemplo n.º 6
0
        public void AutorDAO_EsClaveRepetida_Clave1_EsTrue()
        {
            //Inicializar datos
            AutorDAO autorDAO = new AutorDAO(contexto);
            //Ejecutar método
            var esRepetido = autorDAO.EsClaveRepetida(2, 1);

            //Comprobar resultado
            Assert.True(esRepetido);
        }
Ejemplo n.º 7
0
        public void BuscarAutorID(Autor autor)
        {
            AutorDAO autorDAO = new AutorDAO();

            if (autor.AutorId > 0)
            {
                var autorTemp = autorDAO.BuscarId(autor.AutorId);

                autor.Nome          = autorTemp.Nome;
                autor.Nacionalidade = autorTemp.Nacionalidade;
            }
        }
Ejemplo n.º 8
0
        public IList <Autor> BuscarPorNome(Autor autor)
        {
            AutorDAO autorDAO = new AutorDAO();

            if (autor.Nome != "")
            {
                IList <Autor> autorTemp = autorDAO.BuscarPorAutor(autor.Nome);
                return(autorTemp);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 9
0
 public bool Gravar(Autor obj)
 {
     if (obj.Nome != string.Empty)
     {
         int sucesso = new AutorDAO().Gravar(obj);
         if (sucesso != 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
 public AutorService()
 {
     oAutorDAO = new AutorDAO();
 }
Ejemplo n.º 11
0
 public AutoresController(CursosContext contexto)
 {
     autorDAO = new AutorDAO(contexto);
 }
Ejemplo n.º 12
0
 public static List <Autor> ObtenerPorCoincidenciaNombre(string nombre)
 {
     return(AutorDAO.SelectByLikeNombre(nombre));
 }