Esempio n. 1
0
        public async Task <ActionResult> Index()
        {
            // get all shopify blogs
            var blogs = await _shopify.GetResource <Blog>().AsList();

            return(View(blogs));
        }
Esempio n. 2
0
        public async Task <ActionResult> Index()
        {
            // get all shopify products
            ViewBag.ShopName = (await _shopify.GetShop()).Name;
            var products = await _shopify.GetResource <Product>().AsList();

            return(View(products));
        }
Esempio n. 3
0
        public void ShouldCreateAndFetchBackAProduct()
        {
            var postTask = ShopifyClient.Post("/admin/products", new {
                product = new {
                    title        = "Rearden Metal",
                    body_html    = "Resistant to corrosion and evasion of reality",
                    product_type = "metal"
                }
            });

            postTask.Wait();

            dynamic postResult = postTask.Result;

            String newId = postResult.product.id;

            Assert.NotNull(newId);

            // and fetch it back
            var getTask = ShopifyClient.Get(String.Format("/admin/products/{0}", newId));

            getTask.Wait();
            Assert.NotNull(getTask.Result);
            dynamic getResult = getTask.Result;

            Assert.AreEqual("Rearden Metal", (string)getResult.product.title);

            // and with the typesafe api:
            var getTypeTask = ShopifyClient.GetResource <Product>().Find(Int32.Parse(newId));

            getTypeTask.Wait();
            Assert.AreEqual("Rearden Metal", getTypeTask.Result.Title);
        }