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"); }
public Author CreateAuthor(Author newAuthor) { newAuthor.id = 0; return(libraryRepository.CreateAuthor(newAuthor)); }