public ActionResult CreateAsChild(int id)
        {
            //var result = AllItems.Where(x => x.ProjectTreeId == id).Select( s=>new { s.Title ,s.ReginalPowerCorpRef,s.ProjectTreeRef, ReginalPowerCorpTitle=s.ReginalPowerCorp.Title, ProjectParent=s.ProjectTree.Title,s.LevelCode,s.Code,s.IsTemplate,s.State});
            new EvaluationFactorTreeModel();
            var result = new EvaluationFactorTreeModel {
                EvaluationFactorRef = id
            };


            return(Ok(result));
        }
        public ActionResult Delete([FromBody] EvaluationFactorTreeModel model)
        {
            //validation
            var result = AllItems.Where(x => x.EvaluationFactorId == model.EvaluationFactorId).FirstOrDefault();

            if (result == null)
            {
                return(BadRequest());
            }
            db.Remove(result);
            db.SaveChanges();
            return(Ok());
        }
        public ActionResult Create([FromBody] EvaluationFactorTreeModel model)
        {
            //validation

            if (ModelState.IsValid)
            {
                if (model.EvaluationFactorRef == 0)
                {
                    model.EvaluationFactorRef = null;
                }
                db.Add(model);

                db.SaveChanges();
            }
            return(Ok());
        }
        public ActionResult Edit([FromBody] EvaluationFactorTreeModel model)
        {
            //validation
            var result = AllItems.Where(x => x.EvaluationFactorId == model.EvaluationFactorId).FirstOrDefault();

            if (result == null)
            {
                return(BadRequest());
            }



            result.Title = model.Title;
            result.EvaluationFactorType = model.EvaluationFactorType;
            result.EvaluationFactorRef  = model.EvaluationFactorRef;
            result.State       = model.State;
            result.Description = model.Description;
            db.Update(result);
            db.SaveChanges();
            return(Ok());
        }