public void TestSensorViewModel()
        {
            var viewmodel = new SensorViewModel(sensorService);

            ObservableCollection <Sensor> expectedData = new ObservableCollection <Sensor>(sensorService.All());
            var sensor = sensorService.Find(1);

            viewmodel.SelectedSensor = sensor;

            Assert.AreEqual(expectedData.Count, viewmodel.Sensors.Count);
            Assert.IsNotNull(viewmodel.SelectedSensor);
            Assert.AreEqual(1, viewmodel.SelectedSensor.Sensor_id);
        }
        public async Task <IActionResult> Edit(int id)
        {
            try
            {
                var sensor = await _userSensorService.FindAsync(id);

                var sensorType = _sensorService.Find(sensor.SensorId);

                if (sensor == null)
                {
                    throw new ApplicationException($"Unable to find sensor with ID '{id}'.");
                }
                var sensorValidation = new SensorValidation(sensorType);
                var model            = new SensorEditViewModel(sensor, sensorValidation);

                return(PartialView(model));
            }
            catch
            {
                return(View("PageNotFound"));
            }
        }