Beispiel #1
0
        public ActionResult Save(string data, int id, int projectId,int nodeId, string name,int treeId)
        {
            if(id == 0)
            {
                Cloud cloud = new Cloud()
                {
                    ProjectId = projectId,
                    Json = data,
                    Name = name,
                    NodeId = nodeId,
                    TreeId = treeId
                };

                db.Cloud.Add(cloud);
                db.SaveChanges();

                return Json("/Cloud/Edit?id=" + cloud.Id, JsonRequestBehavior.AllowGet);

            }
            else
            {
                var tree = db.Tree.FirstOrDefault(x => x.Id == id);
                tree.Json = data;
                tree.Name = name;
                db.SaveChanges();
            }

            return Json("Saved", JsonRequestBehavior.AllowGet);
        }
Beispiel #2
0
        public ActionResult New(int projectId,int? nodeId,int? TreeId)
        {
            Cloud model = new Cloud();
            model.ProjectId = projectId;

            if(nodeId.HasValue)
                model.NodeId = nodeId.Value;

            if(TreeId.HasValue)
                model.TreeId = TreeId.Value;

            return View(model);
        }