Example #1
0
        public async Task UpdateAsync(BookModel model)
        {
            BookValidation.CheckBook(model);
            var book = _mapper.Map <Book>(model);

            _unit.BookRepository.Update(book);
            await _unit.SaveAsync();
        }
Example #2
0
        public async Task AddAsync(BookModel model)
        {
            BookValidation.CheckBook(model);

            var book = _mapper.Map <Book>(model);

            await _unit.BookRepository.AddAsync(book);

            await _unit.SaveAsync();

            model.Id = book.Id;
        }