コード例 #1
0
        private static void UpdateSomeObjectsUsingPut(string baseAddress, string token)
        {
            var custRepo = new CustomerRepository(baseAddress, token);
            var campaignRepo = new CampaignRepository(baseAddress, token);
            var orderRepo = new OrderRepository(baseAddress, token);

            var campaigns = custRepo.GetCampaignsForCustomer(38245).Result;

            var firstCampaign = campaigns.First();

            var orders = campaignRepo.GetOrdersForCampaign(firstCampaign.Id.Value).Result;

            var firstOrder = orders.First();

            firstOrder.SpendTarget = firstOrder.SpendTarget + 100;

            orderRepo.UpdateOrder(firstOrder);

            firstCampaign.CampaignName = firstCampaign.CampaignName + " (1)";

            campaignRepo.UpdateCampaign(firstCampaign);

        }
コード例 #2
0
        static void GetSomeObjects(string baseAddress, string token)
        {
            var custRepo = new CustomerRepository(baseAddress, token);
            var campaignRepo = new CampaignRepository(baseAddress, token);
            var orderRepo = new OrderRepository(baseAddress, token);

            "Get a customer".ConsoleGreen();
            custRepo.GetCustomerById(38245).Result.PrintObjectToConsole();

            "Get a campaign".ConsoleGreen();
            campaignRepo.GetCampaignById(25269).Result.PrintObjectToConsole();

            "Get an order: ".ConsoleGreen();
            orderRepo.GetOrderById(42802).Result.PrintObjectToConsole();
        }
コード例 #3
0
        static void AddACampaignToACustomer(string baseAddress, string token, int customerId)
        {
            var campaignRepo = new CampaignRepository(baseAddress, token);
            
            "Create a campaign".ConsoleBlue();
            var campaign = campaignRepo.CreateCampaign(new Campaign
            {
                CampaignName = "Test Campaign",
                CampaignUrl = "http://www.mytestcustomer.com",
                CurrencyCode = "GBP",
                CustomerId = customerId,
                Product = "PPC"
            });

            campaign.Result?.PrintObjectToConsole();
            _campaign = campaign.Result;
        }