public IList <AdminEN> GetAll() { IList <AdminEN> administradores = new List <AdminEN>(); PersonalHomeGenNHibernate.CEN.PersonalHome.AdminCEN adminCEN = null; PersonalHomeGenNHibernate.CAD.PersonalHome.IAdminCAD _IadminCAD = null; try { using (ISession session = NHibernateHelper.OpenSession()) using (ITransaction tx = session.BeginTransaction()) { _IadminCAD = new PersonalHomeGenNHibernate.CAD.PersonalHome.AdminCAD(session); adminCEN = new PersonalHomeGenNHibernate.CEN.PersonalHome.AdminCEN(_IadminCAD); administradores = adminCEN.DameTodos(0, -1); tx.Commit(); } } catch (Exception ex) { throw ex; } return(administradores); }
public string Create(DataUser datos) { string retorno = "ko"; PersonalHomeGenNHibernate.CEN.PersonalHome.AdminCEN adminCEN = null; PersonalHomeGenNHibernate.CAD.PersonalHome.IAdminCAD _IadminCAD = null; try { using (ISession session = NHibernateHelper.OpenSession()) using (ITransaction tx = session.BeginTransaction()) { _IadminCAD = new PersonalHomeGenNHibernate.CAD.PersonalHome.AdminCAD(session); adminCEN = new PersonalHomeGenNHibernate.CEN.PersonalHome.AdminCEN(_IadminCAD); adminCEN.CrearAdmin(datos.User.Email, datos.User.Passwd, datos.User.Nombre); tx.Commit(); retorno = "ok"; } } catch (Exception ex) { throw ex; } return(retorno); }