public void UpdateUser(MUser user) { using (var session = NHIbernateHelper.OpenSession()){ using (var tran = session.BeginTransaction()) { session.Update(user); tran.Commit(); } } }
public IList <MUser> GetAllUser() { using (var session = NHIbernateHelper.OpenSession()) { using (var tran = session.BeginTransaction()) { IQueryOver <MUser, MUser> userlist = session.QueryOver <MUser>(); tran.Commit(); return(userlist.List()); } } }
public void DelUserById(int id) { using (var session = NHIbernateHelper.OpenSession()){ using (var tran = session.BeginTransaction()) { var user = new MUser(); user.Id = id; session.Delete(user); tran.Commit(); } } }
public IList <MUser> GetUserByName(string name) { using (var session = NHIbernateHelper.OpenSession()) { using (var tran = session.BeginTransaction()) { IQueryOver <MUser, MUser> userlist = session.QueryOver <MUser>().Where(p => p.UserName == name); tran.Commit(); return(userlist.List()); } } }