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

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

            throw new Exception("There were an error with the DB");
        }