Exemplo n.º 1
0
        /// <summary>
        /// Updates the given <see cref="OrderStatusModel"/>.
        /// </summary>
        /// <param name="orderStatusId">Id of the object being updated.</param>
        /// <param name="order">The <see cref="OrderStatusCreateUpdateModel"/> to update.</param>
        /// <returns>The updated <see cref="OrderStatusModel"/>.</returns>
        public virtual async Task <OrderStatusModel> PatchAsync(int orderStatusId, OrderStatusCreateUpdateModel order)
        {
            var req     = PrepareRequest($"order-statuses/{orderStatusId}");
            var body    = order.ToDictionary();
            var content = new JsonContent(body);

            return(await ExecuteRequestAsync <OrderStatusModel>(req, HttpMethod.Patch, content, "data"));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new <see cref="OrderStatusModel"/> on the store.
        /// </summary>
        /// <param name="order">A new <see cref="OrderModel"/>. Id should be set to null.</param>
        /// <returns>The new <see cref="OrderStatusModel"/>.</returns>
        public virtual async Task <OrderStatusModel> CreateAsync(OrderStatusCreateUpdateModel order)
        {
            var req     = PrepareRequest("order-statuses");
            var body    = order.ToDictionary();
            var content = new JsonContent(body);

            return(await ExecuteRequestAsync <OrderStatusModel>(req, HttpMethod.Post, content, ""));
        }