public static VistaDTO Convert(VistaEN en) { VistaDTO newinstance = null; if (en != null) { newinstance = new VistaDTO(); newinstance.IdVista = en.IdVista; newinstance.Nombre = en.Nombre; if (en.Estancia != null) { newinstance.Estancia_oid = new System.Collections.Generic.List <Int32>(); foreach (PersonalHomeGenNHibernate.EN.PersonalHome.EstanciaEN entry in en.Estancia) { newinstance.Estancia_oid.Add(entry.IdEstancia); } } if (en.Inmueble != null) { newinstance.Inmueble_oid = new System.Collections.Generic.List <Int32>(); foreach (PersonalHomeGenNHibernate.EN.PersonalHome.InmuebleEN entry in en.Inmueble) { newinstance.Inmueble_oid.Add(entry.IdInmueble); } } } return(newinstance); }
public static VistaEN Convert(VistaDTO dto) { VistaEN newinstance = null; try { if (dto != null) { newinstance = new VistaEN(); newinstance.IdVista = dto.IdVista; newinstance.Nombre = dto.Nombre; if (dto.Estancia_oid != null) { PersonalHomeGenNHibernate.CAD.PersonalHome.IEstanciaCAD estanciaCAD = new PersonalHomeGenNHibernate.CAD.PersonalHome.EstanciaCAD(); newinstance.Estancia = new System.Collections.Generic.List <PersonalHomeGenNHibernate.EN.PersonalHome.EstanciaEN>(); foreach (int entry in dto.Estancia_oid) { newinstance.Estancia.Add(estanciaCAD.ReadOIDDefault(entry)); } } if (dto.Inmueble_oid != null) { PersonalHomeGenNHibernate.CAD.PersonalHome.IInmuebleCAD inmuebleCAD = new PersonalHomeGenNHibernate.CAD.PersonalHome.InmuebleCAD(); newinstance.Inmueble = new System.Collections.Generic.List <PersonalHomeGenNHibernate.EN.PersonalHome.InmuebleEN>(); foreach (int entry in dto.Inmueble_oid) { newinstance.Inmueble.Add(inmuebleCAD.ReadOIDDefault(entry)); } } } } catch (Exception ex) { throw ex; } return(newinstance); }