public JsonResult ReNameNode(BlockFunctionDataContract data) { if (data == null) throw new ArgumentNullException("the data is null!!!"); Module module = this.repository.FindBy(data.Id); module.Name = data.Name; this.repository[module.Key] = module; this.unitOfWork.Commit(); return Json(new { status = module.Status.ToString() }); }
public JsonResult RemoveNode(BlockFunctionDataContract data) { if (data == null) throw new ArgumentNullException("the data for multiple node is null!!!"); if (data.Id == null) throw new ArgumentException("the name for add node is null!!!"); Module module = this.repository.FindBy(data.Id); this.repository.Remove(module); this.unitOfWork.Commit(); return Json(new { status = module.Status.ToString() }); }
public JsonResult Operation(BlockFunctionDataContract data) { if (data == null) { throw new ArgumentNullException("the data for multiple is null!!"); } if (data.Operation == null) throw new ArgumentException("the operation for mulitle is not define!!!"); return this.Operations[data.Operation](data); }
public JsonResult MoveNode(BlockFunctionDataContract data) { return null; }
public JsonResult GetChildren(BlockFunctionDataContract data) { if (data == null) throw new ArgumentNullException("the data for multiple is null!!!"); IList<Node> nodes = null; BlockTree tree = new BlockTree(); if (data.Id == null || data.Id.Value <= 0) { nodes = tree.Roots.ToList(); foreach (var n in nodes) { n.attr.rel = "drive"; } } else { nodes = tree.GetChildren(data.Id.Value).ToList(); } return Json(nodes, JsonRequestBehavior.AllowGet); }
public JsonResult CreateNode(BlockFunctionDataContract data) { if (data == null) throw new ArgumentNullException("the data for multiple node is null!!!"); if (string.IsNullOrEmpty(data.Name)) throw new ArgumentException("the name for add node is null!!!"); Module module = new Module(); module.Name = data.Name; this.repository.Add(module); this.unitOfWork.Commit(); return Json(new { id = module.Key, status = module.Status.ToString() }); }