Beispiel #1
0
        public static Database.node toRaw(Node data)
        {
            var raw = new Database.node()
            {
                physical_address = data.PhysicalAddress,
                friendly_name    = data.FriendlyName,
                water_on         = data.IsWaterOn,
                light_on         = data.IsLightOn,
                behavior_id      = data.BehaviorId,
                user_id          = data.UserId,
            };

            if (data.Id != null)
            {
                raw.id = (int)data.Id;
            }

            if (data.Sensors != null)
            {
                foreach (var sensor in data.Sensors)
                {
                    raw.sensors.Add(Sensor.toRaw(sensor));
                }
            }

            return(raw);
        }
        public static Database.node toRaw(Node data)
        {
            var raw = new Database.node()
            {
                physical_address = data.PhysicalAddress,
                friendly_name = data.FriendlyName,
                water_on = data.IsWaterOn,
                light_on = data.IsLightOn,
                behavior_id = data.BehaviorId,
                user_id = data.UserId,
            };

            if (data.Id != null)
            {
                raw.id = (int)data.Id;
            }

            if (data.Sensors != null)
            {
                foreach (var sensor in data.Sensors)
                {
                    raw.sensors.Add(Sensor.toRaw(sensor));
                }
            }

            return raw;
        }