Пример #1
0
 public static ExternalUser Map(ExternalUserEntity entity)
 {
     return(new ExternalUser()
     {
         IdTercero = entity.IdTercero,
         NombreTercero = entity.NombreTercero,
         TipoTercero = entity.TipoTercero,
         Estado = entity.Estado,
         FechaCreacionTercero = entity.FechaCreacionTercero,
         TelefonoTercero1 = entity.TelefonoTercero1,
         TelefonoTercero2 = entity.TelefonoTercero2,
         TelefonoTercero3 = entity.TelefonoTercero3,
         DireccionTercero1 = entity.DireccionTercero1,
         DireccionTercero2 = entity.DireccionTercero2,
         ObservacionTercero = entity.ObservacionTercero
     });
 }
Пример #2
0
        /// <summary>
        /// 绑定第三方账号
        /// </summary>
        public async Task <ActionObjectResult> BindExternalUser(int clientId, string userId, string providerKey, string loginProvider, string nickname)
        {
            var externalUsers = await GetExternalUsers(clientId, userId);

            var externalUser = externalUsers.FirstOrDefault(c => c.LoginProvider == loginProvider && c.ClientId == clientId);

            if (externalUser != null)
            {
                return(ActionObject.Ok(20026, "通行证账号已绑定过该类型账号"));
            }

            externalUser = await GetExternalUser(clientId, providerKey);

            if (!string.IsNullOrEmpty(externalUser?.UserId))
            {
                return(ActionObject.Ok(20027, "此用户已绑定过通行证账号"));
            }

            var externalUserEntity = new ExternalUserEntity()
            {
                UserId        = userId,
                ProviderKey   = providerKey,
                LoginProvider = loginProvider,
                Nickname      = nickname,
                ClientId      = clientId,
                CreateDate    = DateTime.Now,
            };

            await _externalUserRepository.InsertAsync(externalUserEntity);

            await _unitOfWork.SaveChangesAsync();

            await _redisCache.KeyDeleteAsync(GetExternalUsersRedisKey(clientId, userId));

            await _redisCache.KeyDeleteAsync(GetExternalUserRedisKey(clientId, providerKey));

            return(ActionObject.Ok());
        }
 Task <string> IRepository <ExternalUserEntity> .Update(ExternalUserEntity element)
 {
     throw new NotImplementedException();
 }
 public Task <ExternalUserEntity> Update(int IdEntity, ExternalUserEntity updateEnt)
 {
     throw new NotImplementedException();
 }
 public Task <int> Update(ExternalUserEntity entity)
 {
     throw new NotImplementedException();
 }
        public async Task <ExternalUserEntity> GetById(int id)
        {
            ExternalUserEntity externalUser = await _posDBContext.ExternalUsers.FirstOrDefaultAsync(x => x.IdTercero == id);

            return(externalUser);
        }
 public Task <ExternalUserEntity> Add(ExternalUserEntity entity)
 {
     throw new NotImplementedException();
 }