Esempio n. 1
0
        public async Task <UserInfo> GetByIdAsync(
            decimal userId,
            CancellationToken cancellationToken = default)
        {
            var userInfo = await _userService.GetByIdAsync(userId, cancellationToken);

            return(userInfo);
        }
Esempio n. 2
0
        public async Task <HouseSimpleInfo> GetHouseSimpleInfoByIdAvailableForUserAsync(
            BsonObjectId houseId,
            decimal userId,
            CancellationToken cancellationToken = default)
        {
            var houseSimpleInfo = await _houseService.GetSimpleHouseInfoByIdAvailableForUserAsync(houseId, userId, cancellationToken);

            try
            {
                var ownerInfo = await _userService.GetByIdAsync(houseSimpleInfo.OwnerId, cancellationToken);

                var ownerSimpleInfo = _mapper.Map <UserSimpleInfo>(ownerInfo);
                houseSimpleInfo.OwnerInfo = ownerSimpleInfo;
            }
            catch (UserNotFoundException) { }

            var memberInfos = await _userService.GetByIdsAsync(houseSimpleInfo.MemberIds, cancellationToken);

            var memberSimpleInfos = _mapper.Map <List <UserSimpleInfo> >(memberInfos);

            houseSimpleInfo.MemberInfos = memberSimpleInfos;

            return(houseSimpleInfo);
        }