Exemplo n.º 1
0
        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() });
        }
Exemplo n.º 2
0
        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() });
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 public JsonResult MoveNode(BlockFunctionDataContract data)
 {
     return null;
 }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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() });
        }