Ejemplo n.º 1
0
        public async Task <Author> AddAuthorAsync(Author author)
        {
            var authorEntity = mapper.Map <AuthorEntity>(author);

            authorsRepository.CreateAuthor(authorEntity);
            if (await authorsRepository.SaveChangesAsync())
            {
                return(mapper.Map <Author>(authorEntity));
            }

            throw new Exception("There were an error with the DB");
        }
Ejemplo n.º 2
0
 public Author CreateAuthor(Author newAuthor)
 {
     newAuthor.id = 0;
     return(libraryRepository.CreateAuthor(newAuthor));
 }