/// <summary> /// 更新分步操作信息 /// </summary> /// <param name="inputDtos"></param> /// <returns></returns> public async Task <OperationResult> Update(params DisStepActionInfoInputDto[] inputDtos) { inputDtos.CheckNotNull("inputDtos"); // foreach (DisStepActionInfoInputDto dtoData in inputDtos) { if (string.IsNullOrEmpty(dtoData.StepActionCode)) { return(new OperationResult(OperationResultType.Error, "请正确填写分步操作编号,该组数据不被存储。")); } if (string.IsNullOrEmpty(dtoData.StepActionName)) { return(new OperationResult(OperationResultType.Error, "请正确填写分步操作名称,该组数据不被存储。")); } // if (DisStepActionInfoRepository.CheckExists(x => x.StepActionCode == dtoData.StepActionCode && x.Id != dtoData.Id)) { return(new OperationResult(OperationResultType.Error, $"分步操作编号 {dtoData.StepActionCode} 的数据已存在,该组数据不被存储。")); } if (DisStepActionInfoRepository.CheckExists(x => x.StepActionName == dtoData.StepActionName && x.Id != dtoData.Id)) { return(new OperationResult(OperationResultType.Error, $"分步操作名称 {dtoData.StepActionName} 的数据已存在,该组数据不被存储。")); } } // DisStepActionInfoRepository.UnitOfWork.BeginTransaction(); var result = await DisStepActionInfoRepository.UpdateAsync(inputDtos); DisStepActionInfoRepository.UnitOfWork.Commit(); return(result); }
/// <summary> /// 检查实体是否存在 /// </summary> /// <param name="predicate"></param> /// <param name="id"></param> /// <returns></returns> public bool CheckExists(Expression <Func <DisStepActionInfo, bool> > predicate, Guid id) { return(DisStepActionInfoRepository.CheckExists(predicate, id)); }