コード例 #1
0
        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));
        }
コード例 #2
0
 private void Load(TempStationUser user)
 {
     SensorListData = _userSensorsService.AllByUserId(user.Id).ToList();
 }