Пример #1
0
        public VentataProduct Update(VentataProduct product)
        {
            VentataProduct productWithId = RestHelper.CallResource(
                "PUT", String.Format("{0}?ApiKey={1}",
                                     "product",
                                     storeApiKey), product.ToJSON() //we are going to PUT to Products with the new product information
                ).FromJSON <VentataProduct>();                      //then we convert it the JSON to a Ventata Product

            return(productWithId);
        }
Пример #2
0
        public VentataStore Update(VentataStore store)
        {
            VentataStore storeWithId = RestHelper.CallResource(
                "PUT", String.Format("{0}?ApiKey={1}",
                                     "store",
                                     companyApiKey), store.ToJSON() //we are going to PUT to Stores with the new store information
                ).FromJSON <VentataStore>();                        //then we convert it the JSON to a Ventata Store

            return(storeWithId);
        }
Пример #3
0
        public VentataOrder Update(VentataOrder order)
        {
            VentataOrder orderWithId = RestHelper.CallResource(
                "PUT", String.Format("{0}?ApiKey={1}",
                                     "order",
                                     storeApiKey), order.ToJSON() //we are going to PUT to Orders with the new order information
                ).FromJSON <VentataOrder>();                      //then we convert it the JSON to a Ventata Order

            return(orderWithId);
        }
Пример #4
0
        public VentataStore Get(Guid VentataStoreId)
        {
            VentataStore storeWithId = RestHelper.CallResource(
                "GET", String.Format("{0}/{1}?ApiKey={2}",
                                     "store",
                                     VentataStoreId,
                                     companyApiKey) //we are going to GET from Stores by hitting store/{id}
                ).FromJSON <VentataStore>();        //then we convert it the JSON to a Ventata Store

            return(storeWithId);
        }
Пример #5
0
        public VentataProduct GetProductByStoreCode(string InternalProductId)
        {
            VentataProduct productWithId = RestHelper.CallResource(
                "GET", String.Format("{0}/{1}?ApiKey={2}",
                                     "product/provider/",
                                     InternalProductId,
                                     storeApiKey) //we are going to GET from Products by hitting product/{id}
                ).FromJSON <VentataProduct>();    //then we convert it the JSON to a Ventata Product

            return(productWithId);
        }
Пример #6
0
        public VentataProduct GetNewPrice(Guid VentataProductId)
        {
            VentataProduct productWithId = RestHelper.CallResource(
                "GET", String.Format("{0}/{1}/price?ApiKey={2}",
                                     "product",
                                     VentataProductId,
                                     storeApiKey) //we are going to GET from Products by hitting product/{id}
                ).FromJSON <VentataProduct>();    //then we convert it the JSON to a Ventata Product

            return(productWithId);
        }
Пример #7
0
        public VentataOrder Get(Guid VentataOrderId)
        {
            VentataOrder orderWithId = RestHelper.CallResource(
                "GET", String.Format("{0}/{1}?ApiKey={2}",
                                     "order",
                                     VentataOrderId,
                                     storeApiKey) //we are going to GET from Orders by hitting order/{id}
                ).FromJSON <VentataOrder>();      //then we convert it the JSON to a Ventata Order

            return(orderWithId);
        }
Пример #8
0
        public bool Delete(Guid VentataStoreId)
        {
            //We added a simple try/catch to give some feedback if the call didn't go through
            //I would expand this section to add your own exception handling
            try
            {
                //we are going to DELETE from Stores by hitting store/{id}
                RestHelper.CallResource(
                    "DELETE", String.Format("{0}/{1}?ApiKey={2}",
                                            "store",
                                            VentataStoreId,
                                            companyApiKey)
                    );

                return(true);
            }
            catch
            {
                return(false);
            }
        }