public void Handle(AddHumidityDevice message) { Data.DeviceId = message.DeviceId; this.Bus.Publish(new HumidityDeviceAdded { DeviceId = message.DeviceId }); this.Bus.Return(ResultCode.OK); Console.WriteLine("AddHumidityDevice for device id {0}", message.DeviceId); }
public async Task <string> AddHumidity() { AddHumidityDevice command = new AddHumidityDevice { DeviceId = Guid.NewGuid().ToString() }; int result = await _.Bus.Send(command).Register(); if (result == ResultCode.OK) { return(command.DeviceId); } throw new HttpException((int)HttpStatusCode.BadRequest, "Unable to add device"); }