Example #1
0
 public ActionResult Delete()
 {
     var db = new AccountDBContext();
     Account acc = db.Accounts.Where(p => p.Name == "blog").FirstOrDefault();
     JavaScriptSerializer marshal = new JavaScriptSerializer();
     var clear = new List<Dictionary<string, string>>();
     string emptyJson = marshal.Serialize(clear);
     acc.layoutJSON = emptyJson;
     db.SaveChanges();
     return RedirectToAction("Index");
 }
Example #2
0
 public ActionResult NewPanel(string q)
 {
     var db = new AccountDBContext();
     Account acc = db.Accounts.Where(p => p.Name == "blog").FirstOrDefault();
     JavaScriptSerializer marshal = new JavaScriptSerializer();
     ViewBag.Panels = marshal.Deserialize<List<Dictionary<string, string>>>(acc.layoutJSON);
     if (q != null)
     {
         var dict = marshal.Deserialize<Dictionary<string, string>>(q);
         ViewBag.Panels.Add(dict);
         string newJson = marshal.Serialize(ViewBag.Panels);
         acc.layoutJSON = newJson;
         db.SaveChanges();
     }
     return View("Index");
 }