public void DeleteUser(User user) { using (var session = HibernateHelper.GetCurrentSession()) { using (ITransaction transaction = session.BeginTransaction()) { session.Delete(user); transaction.Commit(); } } }
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); }