protected virtual async Task Update(OrganizationUnitEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _entityRepository.GetAsync(input.Id.Value); input.MapTo(entity); // ObjectMapper.Map(input, entity); await _entityRepository.UpdateAsync(entity); }
protected virtual async Task <OrganizationUnitEditDto> Create(OrganizationUnitEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 // var entity = ObjectMapper.Map <OrganizationUnit>(input); var entity = input.MapTo <OrganizationUnit>(); entity = await _entityRepository.InsertAsync(entity); return(entity.MapTo <OrganizationUnitEditDto>()); }
public async Task <GetOrganizationUnitForEditOutput> GetForEdit(NullableIdDto <long> input) { var output = new GetOrganizationUnitForEditOutput(); OrganizationUnitEditDto editDto; if (input.Id.HasValue) { var entity = await _entityRepository.GetAsync(input.Id.Value); editDto = entity.MapTo <OrganizationUnitEditDto>(); //organizationUnitEditDto = ObjectMapper.Map<List<organizationUnitEditDto>>(entity); } else { editDto = new OrganizationUnitEditDto(); } output.OrganizationUnit = editDto; return(output); }