Esempio n. 1
0
        internal FlightStatus ToDTO()
        {
            var status = new FlightStatus();

            foreach (var field in status.GetType().GetProperties())
            {
                var thisField = this.GetType().GetProperty(field.Name);

                if (thisField != null)
                {
                    field.SetValue(status, thisField.GetValue(this));
                }
            }
            return(status);
        }
Esempio n. 2
0
        public FlightStatusWrapper(string flightId, FlightStatus status)
        {
            if (string.IsNullOrWhiteSpace(flightId))
            {
                throw new ArgumentNullException(nameof(flightId));
            }
            if (status == null)
            {
                throw new ArgumentNullException(nameof(status));
            }

            FlightId = flightId;

            foreach (var field in status.GetType().GetProperties())
            {
                var thisField = this.GetType().GetProperty(field.Name);

                if (thisField != null)
                {
                    thisField.SetValue(this, field.GetValue(status));
                }
            }
        }