public ActionResult RemoveDevice(string deviceId)
        {
            var device = new RegisteredDeviceModel
            {
                HostName = _iotHubName,
                DeviceId = deviceId
            };

            return(View("RemoveDevice", device));
        }
        private async Task <ActionResult> Add(UnregisteredDeviceModel model)
        {
            var deviceWithKeys = await AddDeviceAsync(model);

            var newDevice = new RegisteredDeviceModel
            {
                HostName        = _iotHubName,
                DeviceType      = model.DeviceType,
                DeviceId        = deviceWithKeys.Device.DeviceProperties.DeviceID,
                PrimaryKey      = deviceWithKeys.SecurityKeys.PrimaryKey,
                SecondaryKey    = deviceWithKeys.SecurityKeys.SecondaryKey,
                InstructionsUrl = model.DeviceType.InstructionsUrl
            };

            return(PartialView("_AddDeviceCopy", newDevice));
        }
Exemple #3
0
        private async Task <ActionResult> Add(UnregisteredDeviceModel model)
        {
            Debug.Assert(model != null, "model is a null reference.");
            Debug.Assert(
                model.DeviceType != null,
                "model.DeviceType is a null reference.");

            dynamic deviceWithKeys = await AddDeviceAsync(model);

            var newDevice = new RegisteredDeviceModel
            {
                HostName        = this.iotHubName,
                DeviceType      = model.DeviceType,
                DeviceId        = DeviceSchemaHelper.GetDeviceID(deviceWithKeys.Device),
                PrimaryKey      = deviceWithKeys.SecurityKeys.PrimaryKey,
                SecondaryKey    = deviceWithKeys.SecurityKeys.SecondaryKey,
                InstructionsUrl = model.DeviceType.InstructionsUrl
            };

            return(PartialView("_AddDeviceCopy", newDevice));
        }