public IList <Approach> GetApproaches() { IList <NHApproachDto> approaches = new List <NHApproachDto>(); using (ISession session = this.sessionFactory.OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { approaches = session.QueryOver <NHApproachDto>().List(); transaction.Commit(); } } IList <Approach> results = new List <Approach>(); foreach (NHApproachDto approach in approaches) { Approach model = this.approachFactory.CreateApproach(approach.Id, approach.Name, approach.Criteria); if (approach.EsaId.HasValue) { IEsaRepository repository = this.esaRepositoryFactory.Invoke(this.sessionFactory); Esa esa = repository.GetEsa(approach.EsaId.Value); if (esa != null) { model.AddEsa(esa); } } results.Add(model); } return(results); }
public void CreateEsa(EsaSummaryDto dto) { Esa model = this.factory.CreateEsa(dto.Id, dto.Altitude, dto.Radius, dto.CenterLatitude, dto.CenterLongitude); Approach approach = this.GetSingleApproach(model.ApproachId); approach.AddEsa(model); this.CreateApproach(approach); this.CreateEsa(model); }