public async Task SetVariable(Guid productId, Guid userId, string requestKey, string requestValue)
{
var product = await productRepository.GetByIdAsync(productId);
if (product is null)
{
throw new ProductNotFoundException(productId);
}
var user = await userRepository.GetByIdAsync(productId, userId);
if (user is null)
{
throw new UserNotFoundException(userId);
}
user.SetVariable(requestKey, requestValue);
userRepository.Update(user);
await unitOfWork.SaveChangesAsync();
}
public async Task SetVariable(Guid productId, Guid userId, string requestKey, string requestValue)
{
var product = await productRepository.GetByIdAsync(productId);
if (product is null)
{
throw new ProductNotFoundException(productId);
}
var user = await userRepository.GetByIdAsync(productId, userId);
if (user is null)
{
throw new UserNotFoundException(userId);
}
user.SetVariable(requestKey, requestValue);
userRepository.Update(user);
await unitOfWork.SaveChangesAsync();
}