Ejemplo n.º 1
0
        /// <summary>
        /// Instantiates a WTTTripCollection object from WTTTripCollectionSurrogate object
        /// </summary>
        /// <param name="SurrogateWTTTripCollection">The source WTTTripCollectionSurrogate object</param>
        internal WTTTripCollection(WTTTripCollectionSurrogate SurrogateWTTTripCollection)
        {
            this._StartDate = SurrogateWTTTripCollection.StartDate;

            if (SurrogateWTTTripCollection.Trips != null)
            {
                this._Trips = new List <WTTTrip>();
                foreach (WTTTrip Trip in SurrogateWTTTripCollection.Trips)
                {
                    this._Trips.Add(Trip);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Override method to deserialize a JSON string into a WTTTripCollection
        /// </summary>
        /// <returns></returns>
        public override object ReadJson(JsonReader Reader, Type ObjectType, object ExistingValue, JsonSerializer Serializer)
        {
            //Validate Arguments
            if (Serializer == null)
            {
                throw new ArgumentNullException(ExceptionHelper.GetStaticException("GeneralNullArgument", new string[] { "Serializer" }, new System.Globalization.CultureInfo("en-GB")));
            }

            if (Reader == null)
            {
                throw new ArgumentNullException(ExceptionHelper.GetStaticException("GeneralNullArgument", new string[] { "Reader" }, new System.Globalization.CultureInfo("en-GB")));
            }

            //Deserialize reader into surrogate object
            WTTTripCollectionSurrogate SurrogateTripCollection = Serializer.Deserialize <WTTTripCollectionSurrogate>(Reader);

            return(new WTTTripCollection(SurrogateTripCollection));
        }