Esempio n. 1
0
        public Book CreateBook(Book newBook, int IdAuthor)
        {
            var author = authorsServices.GetAuthor(IdAuthor);

            if (author == null)
            {
                return(null);
            }
            var cantidad = books.Count;

            newBook.Id       = cantidad + 1;
            newBook.idAuthor = IdAuthor;
            books.Add(newBook);
            return(newBook);
        }
Esempio n. 2
0
        public ActionResult <Author> GetAuthor(int id)
        {
            var Author = authorsServices.GetAuthor(id);

            if (Author == null)
            {
                return(NotFound($"El Author con id: {id} no existe"));
            }
            return(Author);
        }