public async Task<Product?> GetByIdAsync(Guid id, Guid? userId = null, CancellationToken token = default)
{
if (userId == null)
{
return await _dbContext.Products.FindAsync(new object?[] { id }, cancellationToken: token);
}
return await _dbContext.Products
.Include(f => f.Rating)
.FirstOrDefaultAsync(f => f.Id == id, cancellationToken: token);
}
public async Task<Product?> GetByIdAsync(Guid id, Guid? userId = null, CancellationToken token = default)
{
if (userId == null)
{
return await _dbContext.Products.FindAsync(new object?[] { id }, cancellationToken: token);
}
return await _dbContext.Products
.Include(f => f.Rating)
.FirstOrDefaultAsync(f => f.Id == id, cancellationToken: token);
}