/// <summary> /// 新增QuestionRecord /// </summary> protected virtual async Task <QuestionRecordEditDto> Create(QuestionRecordEditDto input) { //TODO:新增前的逻辑判断,是否允许新增 var entity = input.MapTo <QuestionRecord>(); entity = await _entityRepository.InsertAsync(entity); await CurrentUnitOfWork.SaveChangesAsync(); return(entity.MapTo <QuestionRecordEditDto>()); }
/// <summary> /// 编辑QuestionRecord /// </summary> protected virtual async Task <QuestionRecord> Update(QuestionRecordEditDto input) { //TODO:更新前的逻辑判断,是否允许更新 var entity = await _entityRepository.GetAsync(input.Id.Value); input.MapTo(entity); // ObjectMapper.Map(input, entity); await _entityRepository.UpdateAsync(entity); await CurrentUnitOfWork.SaveChangesAsync(); return(entity); }