Ejemplo n.º 1
0
        /// <summary>
        /// Return a JSON representation of this object.
        /// </summary>
        public JObject ToJSON(CustomJObjectSerializerDelegate <NamedGeoCoordinate> CustomNamedGeoCoordinateSerializer = null)
        {
            var JSON = JSONObject.Create(

                new JProperty("geoCoordinate", GeoCoordinate.ToJSON()),

                Description.IsNeitherNullNorEmpty()
                               ? new JProperty("description", Description.ToJSON())
                               : null,

                AttachedImages.SafeAny()
                               ? new JProperty("attachedImages", new JArray(AttachedImages))
                               : null,

                AttachedImages.SafeAny()
                               ? new JProperty("attachedFiles", new JArray(AttachedImages))
                               : null,

                CustomData.SafeAny()
                               ? new JProperty("customData", new JObject(CustomData.SafeSelect(data => new JProperty(data.Key, data.Value))))
                               : null

                );

            return(CustomNamedGeoCoordinateSerializer != null
                       ? CustomNamedGeoCoordinateSerializer(this, JSON)
                       : JSON);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Return a JSON representation of the given GeoLocation.
        /// </summary>
        /// <param name="GeoLocation">A geographical location.</param>
        /// <param name="JPropertyKey">The name of the JSON property key to use.</param>
        public static JProperty ToJSON(this GeoCoordinate GeoLocation, String JPropertyKey)
        {
            if (GeoLocation == default)
            {
                return(null);
            }

            return(new JProperty(JPropertyKey,
                                 GeoLocation.ToJSON()));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Return a JSON representation of the given GeoLocation.
 /// </summary>
 /// <param name="GeoLocation">A geographical location.</param>
 public static JObject ToJSON(this GeoCoordinate?GeoLocation)
 => GeoLocation?.ToJSON();