public void Delete(Role role) { try { roleRepository.Delete(role); } catch (Exception ex) { throw ex; } }
public bool Delete(Role entity) { try { using (var session = NHibernateHelper.OpenSession(connString)) { session.Delete(entity); session.Flush(); return true; } } catch (Exception ex) { throw ex; } }
public void Update(Role entity) { try { using (var session = NHibernateHelper.OpenSession(connString)) { session.Update(entity); session.Flush(); } } catch (Exception ex) { throw ex; } }
public bool Add(Role entity) { try { using (var session = NHibernateHelper.OpenSession(connString)) { session.Save(entity); return true; } } catch (Exception) { return false; } }
public void Save(Role role) { try { if (role.ID == 0) { roleRepository.Add(role); } else { roleRepository.Update(role); } } catch (Exception ex) { throw ex; } }
public Role SelectRole(Role entity) { try { using (var session = NHibernateHelper.OpenSession(connString)) { var role = session.QueryOver<Role>().Where(x => x.ID == entity.ID).SingleOrDefault(); return role; } } catch (Exception ex) { throw ex; } }