Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        public void Delete(int id)
        {
            var request = new DeleteClientRequest();

            request.Id = id;
            var response = HttpPost <DeleteClientRequest>("api/client/delete", request, MediaType.Json);
        }
Exemplo n.º 4
0
        public async Task DeleteClientAsync(DeleteClientRequest request)
        {
            var client = await UnitOfWork.ClientRepository.GetClientByConnectionIdAsync(request.ClientConnectionId);

            Ensure.That(client).WithException(x => new NotFoundException(new ErrorDto(ErrorCode.NotFound, "Client does not exist.")));
            await UnitOfWork.ClientRepository.DeleteClientAsync(client.Id);
        }
Exemplo n.º 5
0
 public async Task DeleteClientAsync()
 {
     await CheckAccessTokenAndExecute(new TaskReference(async() =>
     {
         var deleteClientRequest = new DeleteClientRequest(Context.ConnectionId);
         await _memberService.DeleteClientAsync(deleteClientRequest);
     }));
 }
Exemplo n.º 6
0
        public async Task <DeleteClientResponse> Delete(int clientId)
        {
            var request = new DeleteClientRequest {
                ClientId = clientId
            };

            return(await Client.Execute <DeleteClientRequest, DeleteClientResponse>(request));
        }
Exemplo n.º 7
0
 public async Task DeleteClientAsync()
 {
     await SafeExecuteAsync(new TaskReference(async() =>
     {
         var deleteClientRequest = new DeleteClientRequest(Context.ConnectionId);
         await _clientService.DeleteClientAsync(deleteClientRequest);
     }));
 }
Exemplo n.º 8
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();
        }
Exemplo n.º 9
0
 public void delete(DeleteClientRequest request)
 {
     try
     {
         var response = new DeleteClientResponse();
         var bc       = new ClientComponent();
         bc.Delete(request.Id);
     }
     catch (Exception ex)
     {
         var httpError = new HttpResponseMessage()
         {
             StatusCode   = (HttpStatusCode)422,
             ReasonPhrase = ex.Message
         };
         throw new HttpResponseException(httpError);
     }
 }
Exemplo n.º 10
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();
        }
Exemplo n.º 11
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();
        }
Exemplo n.º 12
0
        public override async Task <DeleteClientResponse> DeleteClient(DeleteClientRequest request, ServerCallContext context)
        {
            Tourist client = await _touristRepository.Get(x => x.Id == request.Id).FirstOrDefaultAsync();

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

            _touristRepository.Delete(client);

            var deleteCount = await _touristRepository.SaveChangesAsync();

            var response = new DeleteClientResponse
            {
                Success = deleteCount > 0
            };

            return(response);
        }
Exemplo n.º 13
0
        public async Task DeleteClientAsync(DeleteClientRequest request)
        {
            var client = await UnitOfWork.ClientRepository.GetClientWithMemberAsync(request.ClientConnectionId);

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

            await UnitOfWork.ClientRepository.DeleteClientAsync(client.Id);

            //TODO made for remove broken or not closed connections
            await RemoveInactiveConnectionsAsync(client.MemberId);

            var memberHasClients = await UnitOfWork.ClientRepository.DoesMemberHasClientsAsync(client.MemberId);

            if (!memberHasClients)
            {
                await _memberService.UpdateMemberStatusAsync(client.Member.SaasUserId, UserStatus.Offline);
            }
        }
Exemplo n.º 14
0
 public void DeleteOneWay(DeleteClientRequest request)
 {
     _clients = _clients.Where(x => x.Id != request.Id).ToList();
 }
Exemplo n.º 15
0
 public void DeleteOneWay(DeleteClientRequest request)
 {
     Console.WriteLine("Delete Request: {0}\n", request);
     _clients = _clients.Where(x => x.Id != request.Id).ToList();
 }
Exemplo n.º 16
0
 public Task <BaseResponse> DeleteClient(DeleteClientRequest request, int UserID)
 {
     throw new NotImplementedException();
 }
 public void Delete(DeleteClientRequest request)
 {
     Repository.Delete(request.Id.ToEnumerable());
 }