/// <summary> /// 新增 /// </summary> /// <param name="entity"></param> /// <returns></returns> public JsonResult Add(Relation entity) { ModelState.Remove("ID"); ModelState.Remove("CreatedTime"); ModelState.Remove("UpdatedTime"); ModelState.Remove("IsDelete"); if (ModelState.IsValid) { if (IRelationService.IsExits(x => x.Name == entity.Name)) { return(JResult(Core.Code.ErrorCode.system_name_already_exist, "")); } entity.CreatedTime = entity.UpdatedTime = DateTime.Now; var result = IRelationService.Add(entity); return(JResult(result)); } else { return(ParamsErrorJResult(ModelState)); } }