public List<BE.FacilityAudit> GetFacilityAuditsForFacilityByFacilityGuid(Guid facilityGuid) { DA.FacilityAuditGateway gateway = new DA.FacilityAuditGateway(); List<BE.FacilityAudit> result = new List<BE.FacilityAudit>(); result = gateway.GetForFacilityByFacilityGuid(facilityGuid).ToBusinessEntitiesList(); return result; }
public IEnumerable<BE.FacilityAudit> GetListingsWithDateModifiedByClientGuid(Guid clientGuid) { var listings = this.GetListingByClientGuid(clientGuid); DA.FacilityAuditGateway facilityGateway = new DA.FacilityAuditGateway(); List<BE.FacilityAudit> facilityAuditVMs = new List<BE.FacilityAudit>(); foreach (var listing in listings) { //// find max date record var facilityMaxDate = facilityGateway.GetForFacilityByFacilityGuid(listing.FacilityGuid).Max(m => m.DateModified); //// get last audit record var facilityAuditLast = facilityGateway.GetForFacilityByFacilityGuid(listing.FacilityGuid).First(fa => fa.DateModified == facilityMaxDate); facilityAuditVMs.Add(facilityAuditLast.ToBusinessEntity()); } return facilityAuditVMs; }