Beispiel #1
0
        public async Task <OrderStatus> ValidPayment(Payment pay)
        {
            await Task.Delay(3000);

            //JavaScriptSerializer JSserializer = new JavaScriptSerializer();
            StringContent       httpConent = new StringContent(JsonConverterOld.Serialize <Payment>(pay), Encoding.UTF8, "application/json");
            HttpResponseMessage response   = await client.PostAsync("api/clearSale", httpConent);

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

                OrderStatus os = new OrderStatus();
                os = JsonConvert.DeserializeObject <OrderStatus>(obj);



                return(os);
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
        public async Task <Stone> AddTransacaoStone(Stone stn)
        {
            await Task.Delay(3000);

            //JavaScriptSerializer JSserializer = new JavaScriptSerializer();
            StringContent       httpConent = new StringContent(JsonConverterOld.Serialize <Stone>(stn), Encoding.UTF8, "application/json");
            HttpResponseMessage response   = await client.PostAsync("api/mockStone", httpConent);

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

                Stone stn_new = new Stone();
                //JsonConverter.Serialize()
                obj = obj.Replace(@"\", " ");

                stn_new = JsonConvert.DeserializeObject <Stone>(obj);
                return(stn_new);
            }
            else
            {
                return(null);
            }
        }