示例#1
0
        public void ReturnBook(int idbook)
        {
            Book book = DAO.GetBookTable().GetElement(idbook);

            if (book.status.id != 2)
            {
                throw new TakingTakenBookExceptino();
            }
            book.status = DAO.GetBookStatusTable().GetElement(1);
            DAO.GetBookTable().UpdateElementInDB(book);
        }
        public void GiveBook(int idbook, int idclient)
        {
            Book book = DAO.GetBookTable().GetElement(idbook);

            if (book.status.id != 1)
            {
                throw new GivingGivenBookException();
            }
            Profile profile = DAO.GetProfileTable().GetElement(idclient);

            book.recipient = profile;
            book.issueDate = DateTime.Now;
            book.status    = DAO.GetBookStatusTable().GetElement(2);
            DAO.GetBookTable().UpdateElementInDB(book);
        }