Пример #1
0
        public void AcceptBook(int bookId, int userId)
        {
            var book = _bookRepository.GetById(bookId);

            if (book == null)
            {
                throw new NotFoundException(nameof(Book));
            }

            var user = _readerRepository.GetById(userId);

            if (user == null)
            {
                throw new NotFoundException(nameof(Reader));
            }

            _readerRepository.DeleteBook(user, book);
            book.Available++;
            _bookRepository.Update(book);
        }