public void PutAsync <TResponse>(
     IReturn <TResponse> request,
     Action <TResponse> onSuccess,
     Action <TResponse, Exception> onError)
 {
     _client.PutAsync <TResponse>(request /*, onSuccess, onError*/);
 }
Exemple #2
0
        public async Task Can_post_raw_response_as_raw_JSON_async()
        {
            var request = new GetCustomer {
                CustomerId = 5
            };
            var response = client.Post(request);

            Assert.That(response.Customer.Id, Is.EqualTo(5));

            var requestPath = request.ToPostUrl();

            string json = request.ToJson();

            response = await client.PostAsync <GetCustomerResponse>(requestPath, json);

            Assert.That(response.Customer.Id, Is.EqualTo(5));

            byte[] bytes = json.ToUtf8Bytes();
            response = await client.PutAsync <GetCustomerResponse>(requestPath, bytes);

            Assert.That(response.Customer.Id, Is.EqualTo(5));

            Stream ms = new MemoryStream(bytes);

            response = await client.PostAsync <GetCustomerResponse>(requestPath, ms);

            Assert.That(response.Customer.Id, Is.EqualTo(5));
        }
Exemple #3
0
        public void WhenIUpdateDataThruPutAsyncAction(Table table)
        {
            UpdateOrder       request = table.CreateSet <UpdateOrder>().Single();
            JsonServiceClient client  = GetClient();

            client.PutAsync(request).Wait();
        }
Exemple #4
0
        public void WhenIUpdateDataThruPutAsyncActionWithResponse(Table table)
        {
            UpdateOrder       request = table.CreateSet <UpdateOrder>().Single();
            JsonServiceClient client  = GetClient();
            bool response             = client.PutAsync <bool>(request).Result;

            ScenarioContext.Current[ResopnseKey] = response;
        }
Exemple #5
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (Product != null)
            {
                IServiceClient client = new JsonServiceClient(baseUrl).WithCache();

                var result = await client.PutAsync <UpdateProductResponseDTO>("/products", new UpdateProductRequestDTO { _Id = new ObjectId(Id), Name = Product.Name, Category = Product.Category, Description = Product.Description, Price = Product.Price });
            }

            return(Redirect("/"));
        }
Exemple #6
0
        public async Task UpdateTimer(TimerInfo info)
        {
            DateTime startTime = info.StartDate.AddSeconds(info.PrePaddingSeconds * -1);
            DateTime endTime   = info.EndDate.AddSeconds(info.PostPaddingSeconds);

            UpdateTimerResponse response = await client.PutAsync(new UpdateTimerRequest
            {
                timer_id = info.Id,
                file     = info.Name,
                channel  = info.ChannelId,
                start    = int.Parse(startTime.ToLocalTime().ToString("HHmm")),
                stop     = int.Parse(endTime.ToLocalTime().ToString("HHmm")),
                day      = startTime.ToString("yyyy-MM-dd"),
                weekdays = "-------",
            });
        }