Пример #1
0
        public async Task <Order> SendOrderTransport(OrderTransport orderTransport)
        {
            var url  = string.Format("{0}order/post", AppData.Host);
            var data = JsonConvert.SerializeObject(orderTransport);

            return(await ConnectionService.Post <Order>(url, new StringContent(data, Encoding.UTF8, "application/json"), "Не удалось загрузить данные о заказе"));
        }
Пример #2
0
        public async Task <Order> SendOrderWithStatus(Order order)
        {
            var url  = string.Format("{0}orderstatus", AppData.Host);
            var data = JsonConvert.SerializeObject(order);

            return(await ConnectionService.Post <Order>(url, new StringContent(data, Encoding.UTF8, "application/json"), "Не удалось получить статус заказа"));
        }
Пример #3
0
        protected virtual async Task <T> PostRequest <T>(string url, HttpContent data, string errorMessage)
            where T : YaMoneyBase
        {
            var result = await ConnectionService.Post <T> (url, data, errorMessage);

            if (result.HasError)
            {
                throw new Exception(result.Error);
            }
            else
            {
                return(result);
            }
        }