Ejemplo n.º 1
0
        public Autor getAutorById(int codigoAutor)
        {
            Autor autor = null;

            GestionBibliotecaMVC.Models.Autor aux = new GestionBibliotecaMVC.Models.Autor();
            aux   = aS.getByID(codigoAutor);
            autor = new Autor();
            if (aux == null)
            {
                autor.ErrorMessage = "El Autor no se ha encontrado";
                throw new Exception();
            }
            else
            {
                autor.Nombre    = aux.Nombre;
                autor.Apellidos = aux.Apellidos;
            }
            return(autor);
        }
Ejemplo n.º 2
0
        public Autor getAutorById(int codigoAutor)
        {
            Autor autor = null;

            gestionbibliotecaMVC.BBLL.interfaces.AutorService aS = new AutorServiceImp();
            GestionBibliotecaMVC.Models.Autor aux = aS.getByID(codigoAutor);
            autor = new Autor();
            if (aux == null)
            {
                autor.ErrorMessage = "El autor no se ha encontrado";

                //si el proceso de meter un autor, es indispensable metemos la siguiente instruccion(la app casca),
                //si por el contrario no es indispensable pero queremos notificar que no hay autores, se utilizar el mensaje de error.
                throw new Exception();
            }
            else
            {
                autor.Nombre = aux.Nombre;
            }
            return(autor);
        }