test upload bild
All checks were successful
Branch - test - Build and Push Backend API Docker Image / build-and-push (push) Successful in 22s
All checks were successful
Branch - test - Build and Push Backend API Docker Image / build-and-push (push) Successful in 22s
This commit is contained in:
@@ -132,7 +132,7 @@ namespace Webshop.Application.Services.Admin
|
||||
image.DisplayOrder = currentOrder++;
|
||||
}
|
||||
|
||||
await _productRepository.UpdateProductAsync();
|
||||
await _productRepository.UpdateProductAsync(existingProduct);
|
||||
|
||||
return ServiceResult.Ok();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Webshop.Domain.Interfaces
|
||||
Task<Product?> GetBySlugAsync(string slug);
|
||||
Task AddProductAsync(Product product);
|
||||
Task<Product?> GetProductByIdForUpdateAsync(Guid id); // NEU
|
||||
Task UpdateProductAsync(); // GE<47>NDERT (parameterlos)
|
||||
Task UpdateProductAsync(Product product);
|
||||
Task DeleteProductAsync(Guid id);
|
||||
}
|
||||
}
|
||||
@@ -49,8 +49,14 @@ namespace Webshop.Infrastructure.Repositories
|
||||
}
|
||||
|
||||
// --- KORRIGIERTE UPDATE-METHODE (OHNE PARAMETER) ---
|
||||
public async Task UpdateProductAsync()
|
||||
public async Task UpdateProductAsync(Product product)
|
||||
{
|
||||
// Wir sagen dem DbContext explizit, dass der Zustand dieser Entität "Modifiziert" ist.
|
||||
// Das zwingt EF Core dazu, ALLE Eigenschaften der Entität in der UPDATE-Anweisung zu berücksichtigen.
|
||||
// Es umgeht alle möglichen Probleme mit dem Change Tracking, die durch verschiedene Kontexte
|
||||
// oder komplexe Beziehungs-Updates entstehen können.
|
||||
_context.Entry(product).State = EntityState.Modified;
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user