예제 #1
0
파일: Program.cs 프로젝트: Nelibur/Nelibur
        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();
        }
예제 #2
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();
        }