public async Task <IResultModel> Add(ModelPropertyAddModel model) { var classEntity = await _classRepository.GetAsync(model.ClassId); if (classEntity == null) { return(ResultModel.Failed("关联类不存在")); } var entity = _mapper.Map <ModelPropertyEntity>(model); if (await _repository.Exists(entity)) { return(ResultModel.Failed($"属性名称({entity.Name})已存在")); } var result = await _repository.AddAsync(entity); return(ResultModel.Result(result)); }
public Task <IResultModel> Add(ModelPropertyAddModel model) { return(_service.Add(model)); }