示例#1
0
        public async Task <UserIdentityModel> FindUserWithDetails(string userName)
        {
            var user = await _userManager.FindByNameAsync(userName);

            if (user == null)
            {
                return(null);
            }

            var userModel = _serviceMapper.Map <UserIdentityModel>(user);

            userModel.Roles = await _userManager.GetRolesAsync(user);

            var apartmentId = _apartmentService.GetApartmentByOwnerId(userModel.Id).Id;

            userModel.SensorId = _sensorService.GetByApartmentId(apartmentId).Id;
            return(userModel);
        }