// GET: ShopifyAPIORders public async Task <ActionResult> Index() { //to read my sample JSO rather than use webclient to download it //using (var webClient = new WebClient()) //{ //get a string representation of our JSON //String rawJSON = webClient.DownloadString("http://plantplaces.com/perl/mobile/viewplantsjson.pl?Combined_Name=Redbud"); //convert the JSON string to series of objects //ShopifyAPIORders shopifyAPIORders = JsonConvert.DeserializeObject<ShopifyAPIORders>(json); // Console.WriteLine(shopifyAPIORders.); //ViewBag.Plantcount = plantCollection.Plants.Count; //return //original return statement from scaffolding using (StreamReader reader = new StreamReader("SampleOrders.json")) { string json = reader.ReadToEnd(); ShopifyAPIORders shopifyAPIORders = JsonConvert.DeserializeObject <ShopifyAPIORders>(json); Console.WriteLine(shopifyAPIORders.orders.Length); } return(View(await db.ShopifyAPIORders.ToListAsync())); }
public void LoadJson() { using (StreamReader reader = new StreamReader("SampleOrders.json")) { string json = reader.ReadToEnd(); ShopifyAPIORders shopifyAPIORders = JsonConvert.DeserializeObject <ShopifyAPIORders>(json); Console.WriteLine(shopifyAPIORders.orders.Length); } }
public async Task <ActionResult> DeleteConfirmed(int id) { ShopifyAPIORders shopifyAPIORders = await db.ShopifyAPIORders.FindAsync(id); db.ShopifyAPIORders.Remove(shopifyAPIORders); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "id")] ShopifyAPIORders shopifyAPIORders) { if (ModelState.IsValid) { db.Entry(shopifyAPIORders).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(shopifyAPIORders)); }
public async Task <ActionResult> Create([Bind(Include = "id")] ShopifyAPIORders shopifyAPIORders) { if (ModelState.IsValid) { db.ShopifyAPIORders.Add(shopifyAPIORders); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(shopifyAPIORders)); }
// GET: ShopifyAPIORders/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ShopifyAPIORders shopifyAPIORders = await db.ShopifyAPIORders.FindAsync(id); if (shopifyAPIORders == null) { return(HttpNotFound()); } return(View(shopifyAPIORders)); }