public IActionResult Edit(string deviceId)
        {
            if (deviceId == null)
            {
                return(RedirectToAction(nameof(Index), new { dmessage = DeviceMessageId.DeviceNotFound }));
            }

            Device device = _deviceRepo.Get(deviceId);

            if (device == null)
            {
                return(RedirectToAction(nameof(Index), new { dmessage = DeviceMessageId.DeviceNotFound }));
            }

            if (!device.User.UserId.Equals(GetCurrentUserAsync().Result.Id))
            {
                return(RedirectToAction(nameof(Index), new { dmessage = DeviceMessageId.NotAuthorized }));
            }

            var model = new DeviceEditViewModel
            {
                Id             = device.Id,
                Hostname       = device.Hostname,
                DeviceType     = device.DeviceType.Name,
                DeviceTypeList = _deviceRepo.GetDeviceTypesAll()
            };

            return(PartialView(model));
        }
        public IActionResult AddActive(string deviceId)
        {
            if (deviceId == null)
            {
                return(RedirectToAction("Manage", "Device", new { armessage = ActiveReadingMessageId.ActiveReadingNotFound }));
            }

            Device device = _deviceRepo.Get(deviceId);

            if (device == null)
            {
                return(RedirectToAction("Index", "Device", new { dmessage = DeviceController.DeviceMessageId.DeviceNotFound }));
            }

            ViewData["deviceName"] = device.Hostname;
            var model = new ActiveReadingAddViewModel
            {
                DeviceId        = deviceId,
                ReadingTypeList = _readingsRepo.GetReadingTypesAll()
            };

            return(PartialView(model));
        }