Example #1
0
        public async Task <Thing> Build(IThingConfiguration thingConfiguration)
        {
            var gateway = _gatewayRepository.FirstOrDefault(x => x.Name == thingConfiguration.GatewayName);

            if (gateway == null)
            {
                Log.Warn($"Gateway '{thingConfiguration.GatewayName}' for thing '{thingConfiguration.Name}' not found");

                return(null);
            }

            var thingTemplate = _thingTemplateRepository.GetTemplate(thingConfiguration.Template);

            return(await CreateThing(thingConfiguration, thingTemplate, gateway));
        }