public AutorWS GetAutorById(int codAutor) { AutorWS autor = null; gestionbibliotecaMVC.BBLL.interfaces.AutorService aS = new AutorServiceImp(); gestionbibliotecaMVC.Models.Autor aux = aS.getById(codAutor); autor = new AutorWS(); if (aS == null) { autor.ErrorMessage = "Autor no encontrado."; } else { autor.Nombre = aux.Nombre + " " + aux.Apellidos; } return(autor); }
public Autor getAutorById(int codAutor) { Autor autor = null; gestionbibliotecaMVC.BBLL.interfaces.AutorService aS = new AutorServiceImp(); gestionbibliotecaMVC.Models.Autor aux = aS.getById(codAutor); 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); }
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); }