Exemplo n.º 1
0
 public static LocationReference Map(this ILocationReferenceEntity entity, ILocationQuery locationQuery)
 {
     return(new LocationReference(
                entity.unstructuredLocation,
                entity.namedLocationId == null ? null : locationQuery.GetNamedLocation(entity.namedLocationId.Value),
                locationQuery.GetCountrySubdivision(entity.countrySubdivisionId),
                entity.localityId == null ? null : locationQuery.GetLocality(entity.localityId.Value))
     {
         Id = entity.id
     });
 }
Exemplo n.º 2
0
        public static void MapTo(this LocationReference location, ILocationReferenceEntity entity)
        {
            // Need to ensure that objects match what is in the database.

            if (entity.id != Guid.Empty)
            {
                location.Id = entity.id;
            }

            entity.unstructuredLocation = location.UnstructuredLocation;
            entity.namedLocationId      = (location.NamedLocation == null ? (int?)null : location.NamedLocation.Id);
            entity.countrySubdivisionId = location.CountrySubdivision.Id;
            entity.localityId           = location.Locality == null ? (int?)null : location.Locality.Id;
        }