public Result RuleRegulationTypeAdd([FromForm] Model.RuleRegulationType model) { if (_ruleRegulationTypeBusiness.Exist(x => x.RuleName == model.RuleName && x.ParentId == model.ParentId)) { return new Result { Code = int.MaxValue.ToString(), Succeed = false, Message = "当前目录下已存在:" + model.RuleName + "!" } } ; else { return(_ruleRegulationTypeBusiness.Add(model)); } }
public Result RuleRegulationTypeEdit([FromForm] Model.RuleRegulationType model) { XSchool.Core.Result result = new Result(); if (_ruleRegulationTypeBusiness.Exist(x => x.ParentId == model.ParentId && x.Id != model.Id && x.RuleName == model.RuleName)) { result = new Result { Code = int.MaxValue.ToString(), Succeed = false, Message = "当前目录下已存在:" + model.RuleName + "!" }; //Result.Fail("当前目录下已存在:" + model.RuleName + "!"); } else { result = _ruleRegulationTypeBusiness.Update(model); } return(result); }