test bild upload
All checks were successful
Branch - test - Build and Push Backend API Docker Image / build-and-push (push) Successful in 24s
All checks were successful
Branch - test - Build and Push Backend API Docker Image / build-and-push (push) Successful in 24s
This commit is contained in:
@@ -34,7 +34,7 @@ namespace Webshop.Application.Services.Admin
|
||||
#region Unchanged Methods
|
||||
public async Task<ServiceResult<IEnumerable<AdminProductDto>>> GetAllAdminProductsAsync()
|
||||
{
|
||||
var products = await _context.Products.Include(p => p.Images).Include(p => p.Productcategories).OrderBy(p => p.Name).ToListAsync();
|
||||
var products = await _context.Products.AsNoTracking().Include(p => p.Images).Include(p => p.Productcategories).OrderBy(p => p.Name).ToListAsync();
|
||||
var dtos = products.Select(MapToAdminDto).ToList();
|
||||
return ServiceResult.Ok<IEnumerable<AdminProductDto>>(dtos);
|
||||
}
|
||||
|
||||
@@ -20,17 +20,21 @@ namespace Webshop.Infrastructure.Repositories
|
||||
|
||||
public async Task<IEnumerable<Product>> GetAllProductsAsync()
|
||||
{
|
||||
return await _context.Products.ToListAsync();
|
||||
return await _context.Products.AsNoTracking().ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<Product?> GetProductByIdAsync(Guid id)
|
||||
{
|
||||
return await _context.Products.FindAsync(id);
|
||||
return await _context.Products
|
||||
.AsNoTracking()
|
||||
.FirstOrDefaultAsync(p => p.Id == id);
|
||||
}
|
||||
|
||||
public async Task<Product?> GetBySlugAsync(string slug)
|
||||
{
|
||||
return await _context.Products.FirstOrDefaultAsync(p => p.Slug == slug && p.IsActive);
|
||||
return await _context.Products
|
||||
.AsNoTracking()
|
||||
.FirstOrDefaultAsync(p => p.Slug == slug && p.IsActive);
|
||||
}
|
||||
|
||||
// --- NEUE METHODE ---
|
||||
|
||||
Reference in New Issue
Block a user