Beispiel #1
0
        private static async Task GetCustomers(string address)
        {
            IEntityServicesAsync <Customer> service = new RestApiCustomerService(new HttpClient()
            {
                BaseAddress = new Uri(address)
            });

            var customer = await service.GetAsync();
        }
Beispiel #2
0
        private static async Task GetCustomersTest()
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("https://localhost:5001");

            ICustomerServiceAsync customerService = new RestApiCustomerService(client);

            IEnumerable <Customer> customers = await customerService.GetAsync();

            foreach (var customer in customers)
            {
                Console.WriteLine(customer.FullName);
            }
        }
Beispiel #3
0
        private static async Task AddCustomerTest()
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("https://*****:*****@unisoft.pl")
                                .Generate();

            ICustomerServiceAsync customerService = new RestApiCustomerService(client);
            await customerService.AddAsync(customer);
        }