This commit is contained in:
@@ -153,7 +153,9 @@ public sealed class ProductService(IDbContextFactory<MidrandBooksDbContext> cont
|
||||
{
|
||||
await using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
|
||||
|
||||
var query = context.Products.AsQueryable();
|
||||
var query = context.Products
|
||||
.Include(i => i.Price)
|
||||
.AsQueryable();
|
||||
|
||||
var cultureInfo = CultureInfo.InvariantCulture;
|
||||
|
||||
@@ -304,7 +306,9 @@ public sealed class ProductService(IDbContextFactory<MidrandBooksDbContext> cont
|
||||
{
|
||||
await using var context = await contextFactory.CreateDbContextAsync(cancellationToken);
|
||||
|
||||
var product = await context.Products.AsNoTracking().FirstOrDefaultAsync(p => p.Id == productId, cancellationToken);
|
||||
var product = await context.Products
|
||||
.Include(i => i.Price)
|
||||
.AsNoTracking().FirstOrDefaultAsync(p => p.Id == productId, cancellationToken);
|
||||
|
||||
return product is null
|
||||
? Result.Fail<Product>(new Error($"Product with ID {productId} not found."))
|
||||
|
||||
Reference in New Issue
Block a user