public ActionResult BuyItem() { JsonConnection j = new Models.JsonConnection(); string path = "C:/Users/thawkins/Documents/GitHub/DarkEdenNetworkSite/DarkEdenNetworkSite/Json/Cart.json"; Cart cart = j.Read <Cart>(path); cart.CheckOut(); return(Redirect("/Home/Checkout")); }
public ActionResult BuyGold(FormCollection form) { JsonConnection j = new Models.JsonConnection(); string path = "C:/Users/thawkins/Documents/GitHub/DarkEdenNetworkSite/DarkEdenNetworkSite/Json/Gold.json"; int gold = j.Read <int>(path); gold += int.Parse(form["Amount"]); j.Write <int>(path, gold); return(Redirect("/Home/Market")); }
public ActionResult AddToCart() { JsonConnection j = new Models.JsonConnection(); string path = "C:/Users/thawkins/Documents/GitHub/DarkEdenNetworkSite/DarkEdenNetworkSite/Json/Cart.json"; cart = j.Read <Cart>(path); string id = Request.Params["id"]; string race = Request.Params["race"]; int i = int.Parse(id); var items = dataContext.GoodsListInfoes.Where(m => m.GoodsID == i); foreach (var item in items) { cart[cart.Count()] = item; } j.Write <Cart>(path, cart); string Return = "/Market/"; switch (race) { case "Slayer": Return += race; break; case "Vampire": Return += race; break; case "Ouster": Return += race; break; case "Common": Return += race; break; default: Return = "Market"; break; } return(View(Return)); }