/// <inheritdoc/> public async Task CreateExtendService(ProductExtendServiceDto input) { if (_extendServiceRepository.CheckExists(p => p.ProductId == input.ProductId && p.Name == input.Name)) { throw new AbpValidationException("该增值服务已存在"); } var extendService = input.MapTo <ProductExtendService>(); await _extendServiceRepository.InsertAsync(extendService); }
/// <inheritdoc/> public async Task UpdateExtendService(ProductExtendServiceDto input) { input.Id.CheckGreaterThan("input.Id", 0); if (_extendServiceRepository.CheckExists(p => p.ProductId == input.ProductId && p.Name == input.Name, input.Id)) { throw new AbpValidationException("该增值服务已存在"); } var extendService = await _extendServiceRepository.GetAsync(input.Id); input.MapTo(extendService); await _extendServiceRepository.UpdateAsync(extendService); }