public async Task <IActionResult> Index() { _logger.LogInformation($"{nameof(SensorsController.Index)} called."); var user = await _userManager.GetUserAsync(User); if (user == null) { return(NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.")); } var listSensorData = new List <UserSensorsViewModel>(); var sensors = _userSensorsService.AllByUserId(user.Id); foreach (var sensor in sensors) { listSensorData.Add(new UserSensorsViewModel { Id = sensor.Id, Name = sensor.Name, MacAddress = sensor.MacAddress }); } return(View(listSensorData)); }
private void Load(TempStationUser user) { SensorListData = _userSensorsService.AllByUserId(user.Id).ToList(); }