I made a test with code below to update the Product:
var existing = await _productRepository.FirstOrDefaultAsync(c => c.Id == input.Id);
if (
Since you are not using the existing entity, don't load it.
Use AnyAsync to check if it exists:
var exists = await _productRepository.GetAll().AnyAsync(c => c.Id == input.Id); // Change
if (!exists) // this
throw new UserFriendlyException(L("ProductNotExist"));
var updatedEntity = ObjectMapper.Map(input);
var entity = await _productRepository.UpdateAsync(updatedEntity);
If you want to map to the existing entity:
var existing = await _productRepository.FirstOrDefaultAsync(c => c.Id == input.Id);
if (existing == null)
throw new UserFriendlyException(L("ProductNotExist"));
var updatedEntity = ObjectMapper.Map(input, existing); // Change this