Exemplo n.º 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);

        }
Exemplo n.º 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();
        }
Exemplo n.º 3
0
        static void AddAnOrderToACampaign(string baseAddress, string token, int customerId, int campaignId)
        {
            var orderRepo = new OrderRepository(baseAddress, token);

            "Create an order".ConsoleBlue();
            var order = orderRepo.CreateOrder(new Order
            {
                CustomerId = customerId,
                CampaignId = campaignId,
                StartDate = new DateTime(2016, 02, 01),
                EndDate = new DateTime(2016, 04, 30),
                OrderRef = "MyOrderRef101",//should be unique (it will be made unique if duplicate already exists in your records), if it is not provided we will create a GUID.
                SpendTarget = 1000,
                ClickTarget = 500,// only requred for 'click' package type
                Status = Status.Active
            });

            order.Result?.PrintObjectToConsole();
            _order = order.Result;
        }