예제 #1
0
        public Task <UserWeb> GetById(int pUserId)
        {
            var vHttpClientHandler = new HttpClientHandler();

            vHttpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
            var vHttpClient = new HttpClient(vHttpClientHandler);

            var vChannel = GrpcChannel.ForAddress(gUserServicesUrl, new GrpcChannelOptions {
                HttpClient = vHttpClient
            });
            var vClient = new UserRepo.UserRepoClient(vChannel);

            var vGetUser = vClient.GetById(new UserFilter()
            {
                UserId = pUserId
            });

            UserWeb vUserResult = new UserWeb()
            {
                UserId    = vGetUser.UserId,
                UserName  = vGetUser.UserName,
                UserEmail = vGetUser.UserEMail
            };

            return(Task.FromResult(vUserResult));
        }
예제 #2
0
        public Task <bool> AddUserWeb(UserWeb pUserWeb)
        {
            var vHttpClientHandler = new HttpClientHandler();

            vHttpClientHandler.ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator;
            var vHttpClient = new HttpClient(vHttpClientHandler);

            var vChannel = GrpcChannel.ForAddress(gUserServicesUrl, new GrpcChannelOptions {
                HttpClient = vHttpClient
            });
            var vClient = new UserRepo.UserRepoClient(vChannel);

            Nothing vInsertUser = vClient.Add(new UserServices.User()
            {
                UserName  = pUserWeb.UserName,
                UserEMail = pUserWeb.UserEmail
            });

            return(Task.FromResult(true));
        }