private Coordinate GetGeoPoint(ApplicationServices.Provider.Models.CourseDirectory.Location matchingLocation) { if (!matchingLocation.Address.Latitude.HasValue || !matchingLocation.Address.Longitude.HasValue) { if (matchingLocation.ID.HasValue) { _logger.Warn($"Location {matchingLocation.ID.Value} missing coordinates"); } return(null); } return(new Coordinate { Latitude = matchingLocation.Address.Latitude.Value, Longitude = matchingLocation.Address.Longitude.Value }); }
private Location MapToLocationEntity(ApplicationServices.Provider.Models.CourseDirectory.Location matchingLocation) { var geopoint = GetGeoPoint(matchingLocation); return(new Location { Id = matchingLocation.ID.Value, Name = matchingLocation.Name, Contact = new ContactInformation { Email = matchingLocation.Email, Phone = matchingLocation.Phone, Website = matchingLocation.Website }, Address = new Core.Models.Provider.Address { Address1 = matchingLocation.Address.Address1, Address2 = matchingLocation.Address.Address2, Town = matchingLocation.Address.Town, County = matchingLocation.Address.County, Postcode = matchingLocation.Address.Postcode, GeoPoint = geopoint } }); }