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); }
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(); }
private static void CreateANewCustomer(string baseAddress, string token) { var custRepo = new CustomerRepository(baseAddress, token); "Create a customer".ConsoleBlue(); var customer = custRepo.CreateCustomer(new Customer { CustomerRef = "MyTest101", BusinessName = "My Test Customer", ContactName = "Test", SendReportEmail = "*****@*****.**", BusinessWebsite = "http://www.mytestcustomer.com", IndustryName = "Testing", Market = "United Kingdom" }); customer.Result?.PrintObjectToConsole(); _customer = customer.Result; }