示例#1
0
        static void ExecuteSoap()
        {
            var client = new SoapServiceClient("NeliburSoapService");

            var createRequest = new CreateClientRequest
            {
                Email = "*****@*****.**"
            };
            ClientResponse response = client.Post <ClientResponse>(createRequest);

            var updateRequest = new UpdateClientRequest
            {
                Email = "*****@*****.**",
                Id    = response.Id
            };

            response = client.Put <ClientResponse>(updateRequest);

            var getClientRequest = new GetClientRequest
            {
                Id = response.Id
            };

            response = client.Get <ClientResponse>(getClientRequest);

            var deleteRequest = new DeleteClientRequest
            {
                Id = response.Id
            };

            client.Delete(deleteRequest);
        }
示例#2
0
        public GetClientResponse GetByEmail(GetClientRequest request)
        {
            GetClientResponse clientResponse = new GetClientResponse();

            try
            {
                MASFARMACIADEVContext context = new MASFARMACIADEVContext();
                var query = context.ClientsEntity.Where
                                (c => c.Email == request.Email).FirstOrDefault();
                GetClientResponse clientEntity = new GetClientResponse()
                {
                    IdClient             = query.IdClient,
                    Name                 = query.Name,
                    Surname              = query.Surname,
                    IdentificationNumber = query.IdentificationNumber,
                    IdTypeIdentification = query.IdTypeIdentification,
                    HomeStreet           = query.HomeStreet,
                    HomeHeigth           = query.HomeHeigth,
                    IdPostalCode         = query.IdPostalCode,
                    Email                = query.Email,
                    Phone                = query.Phone
                };
                clientResponse = clientEntity;
            }
            catch (Exception ex)
            {
                Console.WriteLine("ProductDataAccess.GetByEmail : ERROR : " + ex.Message);
                throw;
            }
            return(clientResponse);
        }
示例#3
0
        public GetClientResponse GetClient(GetClientRequest request)
        {
            var result      = new ServerGetClientResponse();
            var returnValue = result.ProcessRequest(cnn, request);

            return(returnValue);
        }
示例#4
0
        public async Task <IActionResult> GetClientAsync(string connectionId)
        {
            var getClientRequest = new GetClientRequest(connectionId);
            var result           = await _clientService.GetClientAsync(getClientRequest);

            return(Ok(result));
        }
示例#5
0
        static void ExecuteJson()
        {
            var client = new JsonServiceClient("http://*****:*****@email.com"
            };
            ClientResponse response = client.Post <ClientResponse>(createRequest);

            var updateRequest = new UpdateClientRequest
            {
                Email = "*****@*****.**",
                Id    = response.Id
            };

            response = client.Put <ClientResponse>(updateRequest);

            var getClientRequest = new GetClientRequest
            {
                Id = response.Id
            };

            response = client.Get <ClientResponse>(getClientRequest);

            var deleteRequest = new DeleteClientRequest
            {
                Id = response.Id
            };

            client.Delete(deleteRequest);
        }
示例#6
0
        public GetClientResponse GetClient(GetClientRequest request)
        {
            Log.Information("LCManagerPartner GetClient {ClientID}", request.ClientID);
            var result      = new ServerGetClientResponse();
            var returnValue = result.ProcessRequest(cnn, request);

            return(returnValue);
        }
 public Client Get(GetClientRequest request)
 {
     if (request.Username != default(string) && request.Password != default(string))
         return
             Repository.Where(x => x.UserId == request.Username && x.Password == request.Password)
                 .SingleOrDefault();
     return Repository.GetById(request.Id);
 }
示例#8
0
        public async Task <GetClientResponse> GetClient(GetClientRequest request)
        {
            var path = "api/Authentication/GetClient";

            return(await RunClient <GetClientRequest, DatabaseService.Models.Client, GetClientResponse>(request, path, (result, response) => {
                response.Client = result;
            }));
        }
示例#9
0
        public object Get(GetClientRequest request)
        {
            Client client = _clients.Single(x => x.Id == request.Id);

            return(new ClientResponse {
                Id = client.Id, Email = client.Email
            });
        }
示例#10
0
 public async Task <ClientResponse> GetClientAsync()
 {
     return(await SafeExecuteAsync(new TaskReference <ClientResponse>(async() =>
     {
         var getClientRequest = new GetClientRequest(Context.ConnectionId);
         return await _clientService.GetClientAsync(getClientRequest);
     })));
 }
示例#11
0
        public object Get(GetClientRequest request)
        {
            Console.WriteLine("Get Request: {0}", request);
            Client client = _clients.Single(x => x.Id == request.Id);

            return(new ClientResponse {
                Id = client.Id, Email = client.Email
            });
        }
示例#12
0
        public async Task <ClientResponse> GetClientAsync(GetClientRequest request)
        {
            var client = await UnitOfWork.ClientRepository.GetClientWithMemberAsync(request.ClientConnectionId);

            if (client == null)
            {
                throw new NetKitChatNotFoundException($"Unable to get client. Client {nameof(request.ClientConnectionId)}:{request.ClientConnectionId} is not found.");
            }

            return(DomainModelsMapper.MapToClientResponse(client));
        }
示例#13
0
        private static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            //                        PerformanceTest();

            var client = new JsonServiceClient(Settings.Default.ServiceAddress);

            var createRequest = new CreateClientRequest
            {
                Email = "*****@*****.**"
            };
            var response = client.Post <ClientResponse>(createRequest);

            Console.WriteLine("POST Response: {0}\n", response);

            var updateRequest = new UpdateClientRequest
            {
                Email = "*****@*****.**",
                Id    = response.Id
            };

            response = client.Put <ClientResponse>(updateRequest);
            Console.WriteLine("PUT Response: {0}\n", response);

            var getClientRequest = new GetClientRequest
            {
                Id   = response.Id,
                Date = DateTime.Now.Date
            };

            response = client.Get <ClientResponse>(getClientRequest);
            Console.WriteLine("GET Response: {0}\n", response);

            var deleteRequest = new DeleteClientRequest
            {
                Id = response.Id
            };

            client.Delete(deleteRequest);

            var certificate = new MemoryStream(File.ReadAllBytes("Certificate.cer"));

            var uploadRequest = new UploadRequest
            {
                FileContents     = certificate.ToArray(),
                OriginalFileName = "MyFileName.cert",
                UploaderId       = Guid.NewGuid().ToString()
            };

            client.Post(uploadRequest);

            Console.ReadKey();
        }
示例#14
0
        public void PrepareGetClientRequest()
        {
            if (GetClientsResponse == null)
            {
                GetClients();
            }

            var client = GetClientsResponse.Result.Randomize().First();

            GetClientRequest = new GetClientRequest
            {
                Id = client.Id,
            };
        }
示例#15
0
        public override async Task <ClientModel> GetClient(GetClientRequest request,
                                                           ServerCallContext context)
        {
            Tourist client = await _touristRepository.GetNoTracking(x => x.Id == request.Id).FirstOrDefaultAsync();

            if (client == null)
            {
                throw new NotFoundException(nameof(Tourist), request.Id);
            }

            ClientModel clientModel = _mapper.Map <ClientModel>(client);

            return(clientModel);
        }
示例#16
0
        public GetClientResponse GetByEmail(GetClientRequest request)
        {
            GetClientResponse getClientResponse = new GetClientResponse();

            try
            {
                getClientResponse = _clientDataAccess.GetByEmail(request.Email);
            }
            catch (Exception ex)
            {
                Console.WriteLine("ProductModel.GetByEmail : ERROR : " + ex.Message);
                throw;
            }
            return(getClientResponse);
        }
示例#17
0
 public GetClientResponse getById(GetClientRequest request)
 {
     try
     {
         var response = new GetClientResponse();
         var bc       = new ClientComponent();
         response.Result = bc.Find(request.Client.Id);
         return(response);
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }
示例#18
0
        private static void Main()
        {
            var client = new SoapServiceClient("NeliburSoapService");

            var createRequest = new CreateClientRequest
            {
                Email = "*****@*****.**"
            };

            Console.WriteLine("POST Request: {0}", createRequest);
            var response = client.Post <ClientResponse>(createRequest);

            Console.WriteLine("POST Response: {0}\n", response);

            var updateRequest = new UpdateClientRequest
            {
                Email = "*****@*****.**",
                Id    = response.Id
            };

            Console.WriteLine("PUT Request: {0}", updateRequest);
            response = client.Put <ClientResponse>(updateRequest);
            Console.WriteLine("PUT Response: {0}\n", response);

            var getClientRequest = new GetClientRequest
            {
                Id = response.Id
            };

            Console.WriteLine("GET Request: {0}", getClientRequest);
            response = client.Get <ClientResponse>(getClientRequest);
            Console.WriteLine("GET Response: {0}\n", response);

            var deleteRequest = new DeleteClientRequest
            {
                Id = response.Id
            };

            Console.WriteLine("DELETE Request: {0}", deleteRequest);
            client.Delete(deleteRequest);

            Console.ReadKey();
        }
示例#19
0
        private static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
            //                        PerformanceTest();

            var client = new JsonServiceClient(Settings.Default.ServiceAddress);

            var createRequest = new CreateClientRequest
            {
                Email = "*****@*****.**"
            };
            var response = client.Post <ClientResponse>(createRequest);

            Console.WriteLine("POST Response: {0}\n", response);

            var updateRequest = new UpdateClientRequest
            {
                Email = "*****@*****.**",
                Id    = response.Id
            };

            response = client.Put <ClientResponse>(updateRequest);
            Console.WriteLine("PUT Response: {0}\n", response);

            var getClientRequest = new GetClientRequest
            {
                Id   = response.Id,
                Date = DateTime.Now.Date
            };

            response = client.Get <ClientResponse>(getClientRequest);
            Console.WriteLine("GET Response: {0}\n", response);

            var deleteRequest = new DeleteClientRequest
            {
                Id = response.Id
            };

            client.Delete(deleteRequest);

            Console.ReadKey();
        }
 /// <summary>
 /// Obtiene los usuarios por nombre o id.
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public GetClientResponse GetClient(GetClientRequest request)
 => _mediator.Send(request).Result;