Exemplo n.º 1
0
        public static DevicePayload UpdateDevice(long referenceId, DevicePayload updates)
        {
            var device = Device.AllDevices.Find(x => x.ReferenceId == referenceId);

            if (device == null)
            {
                return(null);
            }

            ThingsModel.WriteThingProperties(device, updates);
            return(DevicePayload.FromDevice(device));
        }
Exemplo n.º 2
0
        public static ThingPayload UpdateThing(long referenceId, ThingPayload updates)
        {
            Thing thing;

            if (!XmlSaveLoad.Referencables.TryGetValue(referenceId, out thing))
            {
                return(null);
            }

            ThingsModel.WriteThingProperties(thing, updates);
            return(ThingPayload.FromThing(thing));
        }