Пример #1
0
        public TblBooks getBook(int id)
        {
            TblBooks obj = (TblBooks)NHSession.CreateCriteria(typeof(TblBooks))
                           .Add(Restrictions.Eq(Constants.allModelProperties.BookId, id))
                           .UniqueResult();

            return(obj);
        }
Пример #2
0
        public bool DeleteBook(TblBooks book)
        {
            bool result = false;

            using (ITransaction T = NHSession.BeginTransaction())
            {
                try
                {
                    NHSession.Delete(book);
                    T.Commit();
                    result = true;
                }
                catch (Exception ex)
                {
                    T.Rollback();
                }
            }
            return(result);
        }