/// <summary> /// 编辑 /// </summary> protected virtual async Task Update(FlowSchemeEditDto input) { var entity = await _flowSchemeRepository.GetAsync(input.Id); input.MapTo(entity); await _flowSchemeRepository.UpdateAsync(entity); }
/// <summary> /// 新增 /// </summary> protected virtual async Task <FlowSchemeEditDto> Create(FlowSchemeEditDto input) { var entity = input.MapTo <FlowScheme>(); entity = await _flowSchemeRepository.InsertAsync(entity); return(entity.MapTo <FlowSchemeEditDto>()); }
/// <summary> /// 获取编辑 /// </summary> public async Task <GetFlowSchemeForEditOutput> GetForEdit(EntityDto <string> input) { var output = new GetFlowSchemeForEditOutput(); FlowSchemeEditDto editDto; if (!string.IsNullOrEmpty(input.Id)) { var entity = await _flowSchemeRepository.GetAsync(input.Id); editDto = entity.MapTo <FlowSchemeEditDto>(); } else { editDto = new FlowSchemeEditDto(); } output.FlowScheme = editDto; return(output); }