Beispiel #1
0
        public BookDTO Find(int bookID)
        {
            if (bookID == 0)
            {
                throw new ArgumentException("bookID");
            }

            Book book = _bookRepository.Find(bookID);

            if (book == null)
            {
                return(null);
            }

            BookDTO recDTO = BookMapper.Map(book);

            recDTO.IsAvaliable = _borrowRepository.isBookAvaliable(bookID);

            return(recDTO);
        }
Beispiel #2
0
 public void Add(BorrowDTO recDTO)
 {
     if (_borrowRepository.isBookAvaliable(recDTO.BookID))
     {
         Borrow Borrow = BorrowMapper.Map(recDTO);
         _borrowRepository.Add(Borrow);
     }
     else
     {
         throw new DataException("This Book is already borrowed");
     }
 }