Beispiel #1
0
 public void DeleteUser(User user)
 {
     using (var session = HibernateHelper.GetCurrentSession())
     {
         using (ITransaction transaction = session.BeginTransaction())
         {
             session.Delete(user);
             transaction.Commit();
         }
     }
 }
Beispiel #2
0
        public IEnumerable <User> GetAllUsers()
        {
            IList <User> list;

            using (var session = HibernateHelper.GetCurrentSession())
            {
                using (ITransaction transaction = session.BeginTransaction())
                {
                    ICriteria criteria = session.CreateCriteria <User>();
                    list = criteria.List <User>();
                    transaction.Commit();
                }
            }
            return(list);
        }