public static void Update(UserActivation user) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { int i = session.CreateQuery("Update UserActivation set ActivationStatus =:ActivationStatus where UserId = :userid and ID=:id") .SetParameter("id", user.Id) .SetParameter("userid", user.UserId) .SetParameter("ActivationStatus", user.ActivationStatus) .ExecuteUpdate(); transaction.Commit(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } }
public static void Add(UserActivation user) { try { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { session.Save(user); transaction.Commit(); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }