Пример #1
0
        public async Task <uint> PostAsync(AddDBFunction addDB)
        {
            var receipt = await Service.AddDBRequestAndWaitForReceiptAsync(addDB);

            var AddDbEvent = receipt.DecodeAllEvents <DbCreatedEventDTO>();

            return(AddDbEvent.LastOrDefault().Event.DbId);
        }
Пример #2
0
        public Task <TransactionReceipt> AddDBRequestAndWaitForReceiptAsync(byte[] iPAddress, CancellationTokenSource cancellationToken = null)
        {
            var addDBFunction = new AddDBFunction();

            addDBFunction.IPAddress = iPAddress;

            return(ContractHandler.SendRequestAndWaitForReceiptAsync(addDBFunction, cancellationToken));
        }
Пример #3
0
        public Task <string> AddDBRequestAsync(byte[] iPAddress)
        {
            var addDBFunction = new AddDBFunction();

            addDBFunction.IPAddress = iPAddress;

            return(ContractHandler.SendRequestAsync(addDBFunction));
        }
        public async Task <uint> PostAsync(AddDBFunction addDB)
        {
            using (HttpClient client = new HttpClient())
            {
                uint          ret      = uint.MaxValue;
                StringContent cont     = new StringContent(JsonConvert.SerializeObject(addDB));
                var           response = await client.PostAsync(uri + "/", cont);

                if (response.IsSuccessStatusCode)
                {
                    var t = await response.Content.ReadAsStringAsync();

                    ret = JsonConvert.DeserializeObject <uint>(t);
                }
                Globals.AddDB(ret, addDB.IPAddress.ToString());
                return(ret);
            }
        }
Пример #5
0
 public Task <TransactionReceipt> AddDBRequestAndWaitForReceiptAsync(AddDBFunction addDBFunction, CancellationTokenSource cancellationToken = null)
 {
     return(ContractHandler.SendRequestAndWaitForReceiptAsync(addDBFunction, cancellationToken));
 }
Пример #6
0
 public Task <string> AddDBRequestAsync(AddDBFunction addDBFunction)
 {
     return(ContractHandler.SendRequestAsync(addDBFunction));
 }