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); }
public Task Add(PlantEvent ioTEvent) { return(_documentClient.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(_databaseName, _collectionName), ioTEvent)); }