public IList<Role> GetRoles(User user) { using (var session = NHibernateHelper.Instance.OpenSession()) { using (var transcation = session.BeginTransaction()) { var roles = session.QueryOver<Role>().Where(x => x.User.Id == user.Id); transcation.Commit(); return roles.List<Role>(); } } }
public bool RegisterUser(User user) { using (var session = NHibernateHelper.Instance.OpenSession()) { using (var transcation = session.BeginTransaction()) { user.Password = MD5Tool.GetMD5(user.Password); session.Save(user); transcation.Commit(); return true; } } }
public void SetUser(User user) { User = user; }