/// <summary> /// 编辑职位用户表 /// </summary> public virtual async Task UpdateJobPersonAsync(JobPersonEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _jobPersonRepository.GetAsync(input.Id.Value); input.MapTo(entity); await _jobPersonRepository.UpdateAsync(entity); }
/// <summary> /// 新增职位用户表 /// </summary> public virtual async Task <JobPersonEditDto> CreateJobPersonAsync(JobPersonEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = input.MapTo <JobPerson>(); entity = await _jobPersonRepository.InsertAsync(entity); return(entity.MapTo <JobPersonEditDto>()); }
/// <summary> /// 通过Id获取职位用户表信息进行编辑或修改 /// </summary> public async Task <GetJobPersonForEditOutput> GetJobPersonForEditAsync(NullableIdDto <int> input) { var output = new GetJobPersonForEditOutput(); JobPersonEditDto jobPersonEditDto; if (input.Id.HasValue) { var entity = await _jobPersonRepository.GetAsync(input.Id.Value); jobPersonEditDto = entity.MapTo <JobPersonEditDto>(); } else { jobPersonEditDto = new JobPersonEditDto(); } output.JobPerson = jobPersonEditDto; return(output); }