コード例 #1
0
        public virtual User ToUser(securityDto.StorefrontUser userDto)
        {
            var result = new User()
            {
                AllowedStores    = userDto.AllowedStores,
                Email            = userDto.Email,
                Id               = userDto.Id,
                ContactId        = userDto.MemberId,
                PhoneNumber      = userDto.PhoneNumber,
                UserName         = userDto.UserName,
                StoreId          = userDto.StoreId,
                IsRegisteredUser = true
            };

            if (!userDto.Logins.IsNullOrEmpty())
            {
                result.ExternalLogins = userDto.Logins.Select(x => new ExternalUserLoginInfo
                {
                    LoginProvider = x.LoginProvider,
                    ProviderKey   = x.ProviderKey
                }).ToList();
            }

            return(result);
        }
コード例 #2
0
        private async Task <CustomerInfo> GetStorefrontCustomerByUserAsync(coreModel.StorefrontUser user)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }

            CustomerInfo result = null;

            if (!string.IsNullOrEmpty(user.MemberId))
            {
                result = await _customerService.GetCustomerByIdAsync(user.MemberId);
            }

            // User may not have contact record
            if (result == null)
            {
                result = new CustomerInfo
                {
                    Id = user.Id,
                    IsRegisteredUser = true,
                };
            }

            result.UserId        = user.Id;
            result.UserName      = user.UserName;
            result.AllowedStores = user.AllowedStores;

            return(result);
        }
コード例 #3
0
        public virtual User ToUser(securityDto.StorefrontUser userDto)
        {
            var result = new User()
            {
                AllowedStores    = userDto.AllowedStores,
                Email            = userDto.Email,
                Id               = userDto.Id,
                ContactId        = userDto.MemberId,
                PhoneNumber      = userDto.PhoneNumber,
                UserName         = userDto.UserName,
                StoreId          = userDto.StoreId,
                IsRegisteredUser = true
            };

            return(result);
        }
コード例 #4
0
 public static User ToUser(this securityDto.StorefrontUser userDto)
 {
     return(ConverterInstance.ToUser(userDto));
 }