Example #1
0
        public Business.Order UpdateQuantityInOrder(Business.Item item, Business.Order order, int quantity)
        {
            var request = new RestRequest {
                Resource = "/orders/{orderId}/items/{itemId}", Method = Method.PATCH
            };

            request.AddParameter("orderId", order.Id, ParameterType.UrlSegment);
            request.AddParameter("itemId", item.Id, ParameterType.UrlSegment);

            request.AddParameter("application/json", quantity, ParameterType.RequestBody);

            var orderUpdated = Execute <Transport.Order>(request);

            return(Model.Mapping.Instance.Map <Business.Order>(orderUpdated));
        }
Example #2
0
        public Business.Order PatchOrder(Business.Order order)
        {
            var request = new RestRequest {
                Resource = "Orders/{orderId}", Method = Method.PATCH
            };

            request.AddParameter("orderId", order.Id, ParameterType.UrlSegment);

            var orderParam = Model.Mapping.Instance.Map <Transport.Order>(order);

            request.AddParameter("application/json-patch+json", orderParam.Items.ToJson(), ParameterType.RequestBody);

            var orderUpdated = Execute <Transport.Order>(request);

            return(Model.Mapping.Instance.Map <Business.Order>(orderUpdated));
        }
Example #3
0
        public override async Task <IActionResult> PutAsync()
        {
            Business.Order order = await _orderRepository.Create();

            return(Json(order.Id));
        }