public async Task <ApiRequestResult> AddAsync(OrderSettingDto dto) { var command = dto.EntityMap <OrderSettingDto, OrderSetting>(); await _orderSettingRepository.AddAsync(command); return(ApiRequestResult.Success("添加成功")); }
public async Task <ApiRequestResult> UpdateAsync(OrderSettingDto dto) { var entity = await _orderSettingRepository.GetAsync(dto.Id.Value); if (entity == null) { var newEntity = dto.EntityMap <OrderSettingDto, OrderSetting>(); await _orderSettingRepository.AddAsync(newEntity); } else { var updateEntity = dto.EntityMap(entity); await _orderSettingRepository.UpdateAsync(updateEntity); } return(ApiRequestResult.Success("修改成功")); }