예제 #1
0
        public async Task <Book> Insert(Book item)
        {
            DAO.Book dao = _mapper.Map <Book, DAO.Book>(item);
            dao.Author = null;
            dao.SetNewId();

            InsertDAOValidations(dao);

            await _persistence.BeginTransactionAsync();

            await _persistence.InsertAsync(dao);

            await _persistence.CommitAsync();

            return(_mapper.Map <DAO.Book, Book>(dao));
        }
예제 #2
0
        public async Task <Author> Insert(Author item)
        {
            DAO.Author dao = _mapper.Map <Author, DAO.Author>(item);
            dao.SetNewId();

            await _persistence.BeginTransactionAsync();

            await _persistence.InsertAsync(dao);

            await _persistence.CommitAsync();

            return(_mapper.Map <DAO.Author, Author>(dao));
        }