public Training GetTrainingsDetailsFromTrainingLog(int trainingId)
        {
            string   address = string.Format($"Get/?trainingId={trainingId}");
            Training result2 = HttpPostClient.PostAsync <Training>("Training", address, null).Result;

            return(result2);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Console.WriteLine("Hit enter to start test");
            Console.ReadLine();
            HttpPostClient client = new HttpPostClient(true);

            client.SetBaseUrl("https://localhost:8801/Api");

            ComplexObject complex = new ComplexObject();

            complex.NameIn = "Pawel Wujczyk";
            Assert.IsNull(complex.NameOut);

            var index = client.PostAsync <string>("Test", "Index").GetAwaiter().GetResult();

            Assert.AreEqual("Test", index);
            Console.WriteLine("Index string test OK!");


            var nullresult = client.PostAsync <object>("Test", "Null").GetAwaiter().GetResult();

            Console.WriteLine("null test OK!");

            var result = client.PostAsync <ComplexObject>("Test", "FillNameOut", complex).GetAwaiter().GetResult();

            Assert.AreEqual("Pawel Wujczyk", result.NameOut);
            Console.WriteLine("Complex object test OK!");

            Console.Write("If you see this line, it means that test passed ;-)");
            Console.ReadLine();
        }
예제 #3
0
        private void PostTraining(Training training)
        {
            HttpPostClient client = new HttpPostClient(true);

            client.SetBaseUrl(this.TrainingLogApiAddress);

            var result2 = client.PostAsync <object>("Training", "Add", training).Result;

            Console.WriteLine(result2);
        }
        public static async Task Run([ServiceBusTrigger("allegroquene", Connection = "PTPurchase")] Purchase purchase, ILogger log)
        {
            log.LogInformation($"Purchase: {purchase}");

            HttpPostClient client = new HttpPostClient(enableLogging: true);

            client.SetBaseUrl("http://localhost:58197");

            try
            {
                var result1 = await client.PostAsync <int>("Purchase", "Add", purchase);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
 public void UpdateExternalTrainingId(int trainingId, string externalTrainingId)
 {
     string address = string.Format($"UpdateExternalTrainingId/?trainingId={trainingId}&externalTrainingId={externalTrainingId}&externalSystemName=SportsTracker");
     object result2 = HttpPostClient.PostAsync <object>("Training", address, null).Result;
 }
예제 #6
0
 public TrainingLog(string trainingLogAddress, bool logging)
 {
     Client = new HttpPostClient(logging);
     Client.SetBaseUrl(trainingLogAddress);
 }