Ejemplo n.º 1
0
        public async Task <IoTEvent> Handle(AddEvent request, CancellationToken cancellationToken)
        {
            var plant = request.PlantsRepository.SelectByDeviceId(request.IoTEvent.DeviceId);

            if (plant != null)
            {
                var plantEvent = new PlantEvent
                {
                    Plant    = plant,
                    IoTEvent = request.IoTEvent
                };

                await request.EventsRepository.Add(plantEvent);
            }

            return(request.IoTEvent);
        }
Ejemplo n.º 2
0
 public Task Add(PlantEvent ioTEvent)
 {
     return(_documentClient.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(_databaseName, _collectionName), ioTEvent));
 }