private void FixupWorkFlow(WorkFlow previousValue)
        {
            if (previousValue != null && previousValue.TaskNodes.Contains(this))
            {
                previousValue.TaskNodes.Remove(this);
            }

            if (WorkFlow != null)
            {
                if (!WorkFlow.TaskNodes.Contains(this))
                {
                    WorkFlow.TaskNodes.Add(this);
                }
                if (WorkFlowId != WorkFlow.Id)
                {
                    WorkFlowId = WorkFlow.Id;
                }
            }
        }
        public virtual ActionResult AddFlow(WorkFlowView toadd)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var newflow = new WorkFlow();
                    UpdateModel(newflow);
                    //newflow.TaskNodes.Add(new TaskNode {Name="",Description="内置开始节点"});

                    Repository.Add(newflow);
                    Repository.Save();
                    return RedirectToAction(MVC.AppSetting.WorkFlowList(newflow.Id));
                }
                catch
                {
                    return View(toadd);
                }

            }
            ModelState.AddModelError("", "输入不正确");
            return View(toadd);
        }