public async Task <ApiRequestResult> AddAsync(SubjectCategoryDto dto) { var command = dto.EntityMap <SubjectCategoryDto, SubjectCategory>(); await _subjectCategoryRepository.AddAsync(command); return(ApiRequestResult.Success("添加成功")); }
public async Task <ApiRequestResult> UpdateAsync(SubjectCategoryDto dto) { var entity = await _subjectCategoryRepository.GetAsync(dto.Id.Value); var newEntity = dto.EntityMap(entity); await _subjectCategoryRepository.UpdateAsync(newEntity); return(ApiRequestResult.Success("修改成功")); }