From 6f86d0de8790f25baec77bf2c056f8694216a128 Mon Sep 17 00:00:00 2001 From: "Tizian.Breuch" Date: Fri, 1 Aug 2025 10:06:00 +0200 Subject: [PATCH] naming --- ...ntroller.cs => AdminCategoryController.cs} | 10 ++--- ...rysController.cs => CategoryController.cs} | 14 +++---- .../SwaggerFilters/AddExampleSchemaFilter.cs | 2 +- .../DTOs/Products/ProductDto.cs | 2 +- .../Services/Admin/AdminCategoryService.cs | 4 +- .../Services/Admin/AdminProductService.cs | 18 ++++----- .../Services/Public/CategoryService.cs | 4 +- .../Services/Public/ProductService.cs | 8 ++-- Webshop.Domain/Entities/Category.cs | 4 +- Webshop.Domain/Entities/Product.cs | 2 +- .../Data/ApplicationDbContext.cs | 6 +-- ...AddHouseNumberAndTypeToAddress.Designer.cs | 16 ++++---- ...01073120_AddHouseNumberAndTypeToAddress.cs | 38 +++++++++---------- .../ApplicationDbContextModelSnapshot.cs | 16 ++++---- .../Repositories/CategoryRepository.cs | 14 +++---- 15 files changed, 79 insertions(+), 79 deletions(-) rename Webshop.Api/Controllers/Admin/{AdminCategorysController.cs => AdminCategoryController.cs} (90%) rename Webshop.Api/Controllers/Public/{CategorysController.cs => CategoryController.cs} (70%) diff --git a/Webshop.Api/Controllers/Admin/AdminCategorysController.cs b/Webshop.Api/Controllers/Admin/AdminCategoryController.cs similarity index 90% rename from Webshop.Api/Controllers/Admin/AdminCategorysController.cs rename to Webshop.Api/Controllers/Admin/AdminCategoryController.cs index 6046624..2502496 100644 --- a/Webshop.Api/Controllers/Admin/AdminCategorysController.cs +++ b/Webshop.Api/Controllers/Admin/AdminCategoryController.cs @@ -1,4 +1,4 @@ -// src/Webshop.Api/Controllers/Admin/AdminCategoriesController.cs +// src/Webshop.Api/Controllers/Admin/AdmincategorysController.cs using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System; @@ -10,7 +10,7 @@ using Webshop.Application.Services.Admin; namespace Webshop.Api.Controllers.Admin { [ApiController] - [Route("api/v1/admin/categories")] + [Route("api/v1/admin/categorys")] [Authorize(Roles = "Admin")] public class AdminCategorysController : ControllerBase { @@ -22,10 +22,10 @@ namespace Webshop.Api.Controllers.Admin } [HttpGet] - public async Task>> GetAllCategories() + public async Task>> GetAllcategorys() { - var categories = await _adminCategoryService.GetAllAsync(); - return Ok(categories); + var categorys = await _adminCategoryService.GetAllAsync(); + return Ok(categorys); } [HttpGet("{id}")] diff --git a/Webshop.Api/Controllers/Public/CategorysController.cs b/Webshop.Api/Controllers/Public/CategoryController.cs similarity index 70% rename from Webshop.Api/Controllers/Public/CategorysController.cs rename to Webshop.Api/Controllers/Public/CategoryController.cs index d924c55..2d60516 100644 --- a/Webshop.Api/Controllers/Public/CategorysController.cs +++ b/Webshop.Api/Controllers/Public/CategoryController.cs @@ -1,4 +1,4 @@ -// src/Webshop.Api/Controllers/Public/CategoriesController.cs +// src/Webshop.Api/Controllers/Public/categorysController.cs using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; @@ -9,22 +9,22 @@ using Webshop.Application.Services.Public; namespace Webshop.Api.Controllers.Public { [ApiController] - [Route("api/v1/public/categories")] + [Route("api/v1/public/categorys")] [AllowAnonymous] - public class CategorysController : ControllerBase + public class CategoryController : ControllerBase { private readonly ICategoryService _categoryService; - public CategorysController(ICategoryService categoryService) + public CategoryController(ICategoryService categoryService) { _categoryService = categoryService; } [HttpGet] - public async Task>> GetActiveCategories() + public async Task>> GetActivecategorys() { - var categories = await _categoryService.GetAllActiveAsync(); - return Ok(categories); + var categorys = await _categoryService.GetAllActiveAsync(); + return Ok(categorys); } [HttpGet("{slug}")] diff --git a/Webshop.Api/SwaggerFilters/AddExampleSchemaFilter.cs b/Webshop.Api/SwaggerFilters/AddExampleSchemaFilter.cs index a38e162..4edff89 100644 --- a/Webshop.Api/SwaggerFilters/AddExampleSchemaFilter.cs +++ b/Webshop.Api/SwaggerFilters/AddExampleSchemaFilter.cs @@ -115,7 +115,7 @@ namespace Webshop.Api.SwaggerFilters ["stockQuantity"] = new OpenApiInteger(100), ["imageUrl"] = new OpenApiString("https://example.com/images/public_prod.jpg"), ["slug"] = new OpenApiString($"public-produkt-beispiel-{uniqueId}"), - ["categories"] = new OpenApiArray + ["categorys"] = new OpenApiArray { new OpenApiObject { diff --git a/Webshop.Application/DTOs/Products/ProductDto.cs b/Webshop.Application/DTOs/Products/ProductDto.cs index 2923492..b2ab613 100644 --- a/Webshop.Application/DTOs/Products/ProductDto.cs +++ b/Webshop.Application/DTOs/Products/ProductDto.cs @@ -19,6 +19,6 @@ namespace Webshop.Application.DTOs.Products public int StockQuantity { get; set; } public string? ImageUrl { get; set; } public string Slug { get; set; } = string.Empty; - public List Categories { get; set; } = new List(); + public List categorys { get; set; } = new List(); } } diff --git a/Webshop.Application/Services/Admin/AdminCategoryService.cs b/Webshop.Application/Services/Admin/AdminCategoryService.cs index be1b4b8..2cbfff7 100644 --- a/Webshop.Application/Services/Admin/AdminCategoryService.cs +++ b/Webshop.Application/Services/Admin/AdminCategoryService.cs @@ -20,8 +20,8 @@ namespace Webshop.Application.Services.Admin public async Task> GetAllAsync() { - var categories = await _categoryRepository.GetAllAsync(); - return categories.Select(c => new CategoryDto + var categorys = await _categoryRepository.GetAllAsync(); + return categorys.Select(c => new CategoryDto { Id = c.Id, Name = c.Name, diff --git a/Webshop.Application/Services/Admin/AdminProductService.cs b/Webshop.Application/Services/Admin/AdminProductService.cs index 29cf028..e078d70 100644 --- a/Webshop.Application/Services/Admin/AdminProductService.cs +++ b/Webshop.Application/Services/Admin/AdminProductService.cs @@ -27,7 +27,7 @@ namespace Webshop.Application.Services.Admin { // Wir verwenden den DbContext, um auch die Kategorien effizient mitzuladen var products = await _context.Products - .Include(p => p.ProductCategories) + .Include(p => p.Productcategorys) .ToListAsync(); return products.Select(p => new AdminProductDto @@ -48,14 +48,14 @@ namespace Webshop.Application.Services.Admin LastModifiedDate = p.LastModifiedDate, SupplierId = p.SupplierId, PurchasePrice = p.PurchasePrice, - CategoryIds = p.ProductCategories.Select(pc => pc.CategoryId).ToList() // << NEU >> + CategoryIds = p.Productcategorys.Select(pc => pc.CategoryId).ToList() // << NEU >> }).ToList(); } public async Task GetAdminProductByIdAsync(Guid id) { var product = await _context.Products - .Include(p => p.ProductCategories) // << NEU: Lade die Join-Tabelle mit >> + .Include(p => p.Productcategorys) // << NEU: Lade die Join-Tabelle mit >> .FirstOrDefaultAsync(p => p.Id == id); if (product == null) return null; @@ -78,7 +78,7 @@ namespace Webshop.Application.Services.Admin LastModifiedDate = product.LastModifiedDate, SupplierId = product.SupplierId, PurchasePrice = product.PurchasePrice, - CategoryIds = product.ProductCategories.Select(pc => pc.CategoryId).ToList() // << NEU: Mappe die CategoryIds >> + CategoryIds = product.Productcategorys.Select(pc => pc.CategoryId).ToList() // << NEU: Mappe die CategoryIds >> }; } @@ -101,13 +101,13 @@ namespace Webshop.Application.Services.Admin CreatedDate = DateTimeOffset.UtcNow, SupplierId = productDto.SupplierId, PurchasePrice = productDto.PurchasePrice, - ProductCategories = new List() // Initialisiere die Collection + Productcategorys = new List() // Initialisiere die Collection }; // << NEU: Füge die Kategorien hinzu >> foreach (var categoryId in productDto.CategoryIds) { - newProduct.ProductCategories.Add(new ProductCategory { CategoryId = categoryId }); + newProduct.Productcategorys.Add(new ProductCategory { CategoryId = categoryId }); } await _productRepository.AddProductAsync(newProduct); // << KORREKT: VERWENDET AddProductAsync >> @@ -119,7 +119,7 @@ namespace Webshop.Application.Services.Admin public async Task UpdateAdminProductAsync(AdminProductDto productDto) { var existingProduct = await _context.Products - .Include(p => p.ProductCategories) // Lade die aktuellen Zuweisungen + .Include(p => p.Productcategorys) // Lade die aktuellen Zuweisungen .FirstOrDefaultAsync(p => p.Id == productDto.Id); if (existingProduct == null) return false; @@ -141,10 +141,10 @@ namespace Webshop.Application.Services.Admin existingProduct.LastModifiedDate = DateTimeOffset.UtcNow; // << NEU: Kategorien synchronisieren (alte löschen, neue hinzufügen) >> - existingProduct.ProductCategories.Clear(); + existingProduct.Productcategorys.Clear(); foreach (var categoryId in productDto.CategoryIds) { - existingProduct.ProductCategories.Add(new ProductCategory { ProductId = existingProduct.Id, CategoryId = categoryId }); + existingProduct.Productcategorys.Add(new ProductCategory { ProductId = existingProduct.Id, CategoryId = categoryId }); } // << ENDE NEUER TEIL >> diff --git a/Webshop.Application/Services/Public/CategoryService.cs b/Webshop.Application/Services/Public/CategoryService.cs index 52fe8e0..6db7e32 100644 --- a/Webshop.Application/Services/Public/CategoryService.cs +++ b/Webshop.Application/Services/Public/CategoryService.cs @@ -18,10 +18,10 @@ namespace Webshop.Application.Services.Public public async Task> GetAllActiveAsync() { - var categories = await _categoryRepository.GetAllAsync(); + var categorys = await _categoryRepository.GetAllAsync(); // Hier könnte man eine Baumstruktur aufbauen, für den Anfang eine flache Liste - return categories + return categorys .Where(c => c.IsActive) .Select(c => new CategoryDto { diff --git a/Webshop.Application/Services/Public/ProductService.cs b/Webshop.Application/Services/Public/ProductService.cs index 283f10d..9d20c44 100644 --- a/Webshop.Application/Services/Public/ProductService.cs +++ b/Webshop.Application/Services/Public/ProductService.cs @@ -26,7 +26,7 @@ namespace Webshop.Application.Services.Public { // Wir verwenden den DbContext, um Produkte und ihre Kategorien zu laden var products = await _context.Products - .Include(p => p.ProductCategories) // Lade die Join-Tabelle + .Include(p => p.Productcategorys) // Lade die Join-Tabelle .ThenInclude(pc => pc.Category) // Lade die zugehörige Kategorie-Entität .Where(p => p.IsActive) // Nur aktive Produkte .ToListAsync(); @@ -41,7 +41,7 @@ namespace Webshop.Application.Services.Public ImageUrl = p.ImageUrl, IsInStock = p.IsInStock, Slug = p.Slug, - Categories = p.ProductCategories.Select(pc => new CategoryDto + categorys = p.Productcategorys.Select(pc => new CategoryDto { Id = pc.Category.Id, Name = pc.Category.Name, @@ -54,7 +54,7 @@ namespace Webshop.Application.Services.Public public async Task GetProductBySlugAsync(string slug) { var product = await _context.Products - .Include(p => p.ProductCategories) + .Include(p => p.Productcategorys) .ThenInclude(pc => pc.Category) .FirstOrDefaultAsync(p => p.Slug == slug && p.IsActive); // Nur aktives Produkt finden @@ -73,7 +73,7 @@ namespace Webshop.Application.Services.Public ImageUrl = product.ImageUrl, IsInStock = product.IsInStock, Slug = product.Slug, - Categories = product.ProductCategories.Select(pc => new CategoryDto + categorys = product.Productcategorys.Select(pc => new CategoryDto { Id = pc.Category.Id, Name = pc.Category.Name, diff --git a/Webshop.Domain/Entities/Category.cs b/Webshop.Domain/Entities/Category.cs index c948764..6eeb838 100644 --- a/Webshop.Domain/Entities/Category.cs +++ b/Webshop.Domain/Entities/Category.cs @@ -44,8 +44,8 @@ namespace Webshop.Domain.Entities // Navigation Properties public virtual Category? ParentCategory { get; set; } - public virtual ICollection SubCategories { get; set; } = new List(); - public virtual ICollection ProductCategories { get; set; } = new List(); + public virtual ICollection Subcategorys { get; set; } = new List(); + public virtual ICollection Productcategorys { get; set; } = new List(); public virtual ICollection CategoryDiscounts { get; set; } = new List(); } } \ No newline at end of file diff --git a/Webshop.Domain/Entities/Product.cs b/Webshop.Domain/Entities/Product.cs index 3a0542a..e5b10c1 100644 --- a/Webshop.Domain/Entities/Product.cs +++ b/Webshop.Domain/Entities/Product.cs @@ -67,5 +67,5 @@ public class Product public virtual ICollection Variants { get; set; } = new List(); public virtual ICollection Reviews { get; set; } = new List(); public virtual ICollection ProductDiscounts { get; set; } = new List(); - public virtual ICollection ProductCategories { get; set; } = new List(); + public virtual ICollection Productcategorys { get; set; } = new List(); } diff --git a/Webshop.Infrastructure/Data/ApplicationDbContext.cs b/Webshop.Infrastructure/Data/ApplicationDbContext.cs index 58245be..44f50fb 100644 --- a/Webshop.Infrastructure/Data/ApplicationDbContext.cs +++ b/Webshop.Infrastructure/Data/ApplicationDbContext.cs @@ -14,7 +14,7 @@ namespace Webshop.Infrastructure.Data public DbSet Products { get; set; } = default!; public DbSet ProductVariants { get; set; } = default!; - public DbSet Categories { get; set; } = default!; + public DbSet categorys { get; set; } = default!; public DbSet Customers { get; set; } = default!; public DbSet
Addresses { get; set; } = default!; public DbSet Orders { get; set; } = default!; @@ -26,7 +26,7 @@ namespace Webshop.Infrastructure.Data public DbSet PaymentMethods { get; set; } = default!; public DbSet Settings { get; set; } = default!; - public DbSet ProductCategories { get; set; } = default!; + public DbSet Productcategorys { get; set; } = default!; public DbSet ProductDiscounts { get; set; } = default!; public DbSet CategoryDiscounts { get; set; } = default!; @@ -101,7 +101,7 @@ namespace Webshop.Infrastructure.Data modelBuilder.Entity() .HasOne(c => c.ParentCategory) - .WithMany(c => c.SubCategories) + .WithMany(c => c.Subcategorys) .HasForeignKey(c => c.ParentCategoryId) .OnDelete(DeleteBehavior.Restrict); diff --git a/Webshop.Infrastructure/Migrations/20250801073120_AddHouseNumberAndTypeToAddress.Designer.cs b/Webshop.Infrastructure/Migrations/20250801073120_AddHouseNumberAndTypeToAddress.Designer.cs index e06787a..2d418cf 100644 --- a/Webshop.Infrastructure/Migrations/20250801073120_AddHouseNumberAndTypeToAddress.Designer.cs +++ b/Webshop.Infrastructure/Migrations/20250801073120_AddHouseNumberAndTypeToAddress.Designer.cs @@ -264,7 +264,7 @@ namespace Webshop.Infrastructure.Migrations b.HasIndex("Slug") .IsUnique(); - b.ToTable("Categories"); + b.ToTable("categorys"); }); modelBuilder.Entity("Webshop.Domain.Entities.CategoryDiscount", b => @@ -667,7 +667,7 @@ namespace Webshop.Infrastructure.Migrations b.HasIndex("CategoryId"); - b.ToTable("ProductCategories"); + b.ToTable("Productcategorys"); }); modelBuilder.Entity("Webshop.Domain.Entities.ProductDiscount", b => @@ -1009,7 +1009,7 @@ namespace Webshop.Infrastructure.Migrations modelBuilder.Entity("Webshop.Domain.Entities.Category", b => { b.HasOne("Webshop.Domain.Entities.Category", "ParentCategory") - .WithMany("SubCategories") + .WithMany("Subcategorys") .HasForeignKey("ParentCategoryId") .OnDelete(DeleteBehavior.Restrict); @@ -1120,13 +1120,13 @@ namespace Webshop.Infrastructure.Migrations modelBuilder.Entity("Webshop.Domain.Entities.ProductCategory", b => { b.HasOne("Webshop.Domain.Entities.Category", "Category") - .WithMany("ProductCategories") + .WithMany("Productcategorys") .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Webshop.Domain.Entities.Product", "Product") - .WithMany("ProductCategories") + .WithMany("Productcategorys") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1196,9 +1196,9 @@ namespace Webshop.Infrastructure.Migrations { b.Navigation("CategoryDiscounts"); - b.Navigation("ProductCategories"); + b.Navigation("Productcategorys"); - b.Navigation("SubCategories"); + b.Navigation("Subcategorys"); }); modelBuilder.Entity("Webshop.Domain.Entities.Customer", b => @@ -1224,7 +1224,7 @@ namespace Webshop.Infrastructure.Migrations modelBuilder.Entity("Webshop.Domain.Entities.Product", b => { - b.Navigation("ProductCategories"); + b.Navigation("Productcategorys"); b.Navigation("ProductDiscounts"); diff --git a/Webshop.Infrastructure/Migrations/20250801073120_AddHouseNumberAndTypeToAddress.cs b/Webshop.Infrastructure/Migrations/20250801073120_AddHouseNumberAndTypeToAddress.cs index 30771d9..b450b72 100644 --- a/Webshop.Infrastructure/Migrations/20250801073120_AddHouseNumberAndTypeToAddress.cs +++ b/Webshop.Infrastructure/Migrations/20250801073120_AddHouseNumberAndTypeToAddress.cs @@ -13,7 +13,7 @@ namespace Webshop.Infrastructure.Migrations protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( - name: "Categories", + name: "categorys", columns: table => new { Id = table.Column(type: "uuid", nullable: false), @@ -29,11 +29,11 @@ namespace Webshop.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_Categories", x => x.Id); + table.PrimaryKey("PK_categorys", x => x.Id); table.ForeignKey( - name: "FK_Categories_Categories_ParentCategoryId", + name: "FK_categorys_categorys_ParentCategoryId", column: x => x.ParentCategoryId, - principalTable: "Categories", + principalTable: "categorys", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); @@ -164,9 +164,9 @@ namespace Webshop.Infrastructure.Migrations { table.PrimaryKey("PK_CategoryDiscounts", x => new { x.CategoryId, x.DiscountId }); table.ForeignKey( - name: "FK_CategoryDiscounts_Categories_CategoryId", + name: "FK_CategoryDiscounts_categorys_CategoryId", column: x => x.CategoryId, - principalTable: "Categories", + principalTable: "categorys", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( @@ -450,7 +450,7 @@ namespace Webshop.Infrastructure.Migrations }); migrationBuilder.CreateTable( - name: "ProductCategories", + name: "Productcategorys", columns: table => new { ProductId = table.Column(type: "uuid", nullable: false), @@ -458,15 +458,15 @@ namespace Webshop.Infrastructure.Migrations }, constraints: table => { - table.PrimaryKey("PK_ProductCategories", x => new { x.ProductId, x.CategoryId }); + table.PrimaryKey("PK_Productcategorys", x => new { x.ProductId, x.CategoryId }); table.ForeignKey( - name: "FK_ProductCategories_Categories_CategoryId", + name: "FK_Productcategorys_categorys_CategoryId", column: x => x.CategoryId, - principalTable: "Categories", + principalTable: "categorys", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( - name: "FK_ProductCategories_Products_ProductId", + name: "FK_Productcategorys_Products_ProductId", column: x => x.ProductId, principalTable: "Products", principalColumn: "Id", @@ -594,13 +594,13 @@ namespace Webshop.Infrastructure.Migrations column: "CustomerId"); migrationBuilder.CreateIndex( - name: "IX_Categories_ParentCategoryId", - table: "Categories", + name: "IX_categorys_ParentCategoryId", + table: "categorys", column: "ParentCategoryId"); migrationBuilder.CreateIndex( - name: "IX_Categories_Slug", - table: "Categories", + name: "IX_categorys_Slug", + table: "categorys", column: "Slug", unique: true); @@ -669,8 +669,8 @@ namespace Webshop.Infrastructure.Migrations column: "ShippingMethodId"); migrationBuilder.CreateIndex( - name: "IX_ProductCategories_CategoryId", - table: "ProductCategories", + name: "IX_Productcategorys_CategoryId", + table: "Productcategorys", column: "CategoryId"); migrationBuilder.CreateIndex( @@ -769,7 +769,7 @@ namespace Webshop.Infrastructure.Migrations name: "OrderItems"); migrationBuilder.DropTable( - name: "ProductCategories"); + name: "Productcategorys"); migrationBuilder.DropTable( name: "ProductDiscounts"); @@ -802,7 +802,7 @@ namespace Webshop.Infrastructure.Migrations name: "ProductVariants"); migrationBuilder.DropTable( - name: "Categories"); + name: "categorys"); migrationBuilder.DropTable( name: "Discounts"); diff --git a/Webshop.Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs b/Webshop.Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs index 5b3bacb..3840db8 100644 --- a/Webshop.Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/Webshop.Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs @@ -261,7 +261,7 @@ namespace Webshop.Infrastructure.Migrations b.HasIndex("Slug") .IsUnique(); - b.ToTable("Categories"); + b.ToTable("categorys"); }); modelBuilder.Entity("Webshop.Domain.Entities.CategoryDiscount", b => @@ -664,7 +664,7 @@ namespace Webshop.Infrastructure.Migrations b.HasIndex("CategoryId"); - b.ToTable("ProductCategories"); + b.ToTable("Productcategorys"); }); modelBuilder.Entity("Webshop.Domain.Entities.ProductDiscount", b => @@ -1006,7 +1006,7 @@ namespace Webshop.Infrastructure.Migrations modelBuilder.Entity("Webshop.Domain.Entities.Category", b => { b.HasOne("Webshop.Domain.Entities.Category", "ParentCategory") - .WithMany("SubCategories") + .WithMany("Subcategorys") .HasForeignKey("ParentCategoryId") .OnDelete(DeleteBehavior.Restrict); @@ -1117,13 +1117,13 @@ namespace Webshop.Infrastructure.Migrations modelBuilder.Entity("Webshop.Domain.Entities.ProductCategory", b => { b.HasOne("Webshop.Domain.Entities.Category", "Category") - .WithMany("ProductCategories") + .WithMany("Productcategorys") .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("Webshop.Domain.Entities.Product", "Product") - .WithMany("ProductCategories") + .WithMany("Productcategorys") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); @@ -1193,9 +1193,9 @@ namespace Webshop.Infrastructure.Migrations { b.Navigation("CategoryDiscounts"); - b.Navigation("ProductCategories"); + b.Navigation("Productcategorys"); - b.Navigation("SubCategories"); + b.Navigation("Subcategorys"); }); modelBuilder.Entity("Webshop.Domain.Entities.Customer", b => @@ -1221,7 +1221,7 @@ namespace Webshop.Infrastructure.Migrations modelBuilder.Entity("Webshop.Domain.Entities.Product", b => { - b.Navigation("ProductCategories"); + b.Navigation("Productcategorys"); b.Navigation("ProductDiscounts"); diff --git a/Webshop.Infrastructure/Repositories/CategoryRepository.cs b/Webshop.Infrastructure/Repositories/CategoryRepository.cs index 0afc847..7fc9b7d 100644 --- a/Webshop.Infrastructure/Repositories/CategoryRepository.cs +++ b/Webshop.Infrastructure/Repositories/CategoryRepository.cs @@ -20,37 +20,37 @@ namespace Webshop.Infrastructure.Repositories public async Task> GetAllAsync() { - return await _context.Categories.ToListAsync(); + return await _context.categorys.ToListAsync(); } public async Task GetByIdAsync(Guid id) { - return await _context.Categories.FindAsync(id); + return await _context.categorys.FindAsync(id); } public async Task GetBySlugAsync(string slug) { - return await _context.Categories.FirstOrDefaultAsync(c => c.Slug == slug); + return await _context.categorys.FirstOrDefaultAsync(c => c.Slug == slug); } public async Task AddAsync(Category category) { - _context.Categories.Add(category); + _context.categorys.Add(category); await _context.SaveChangesAsync(); } public async Task UpdateAsync(Category category) { - _context.Categories.Update(category); + _context.categorys.Update(category); await _context.SaveChangesAsync(); } public async Task DeleteAsync(Guid id) { - var category = await _context.Categories.FindAsync(id); + var category = await _context.categorys.FindAsync(id); if (category != null) { - _context.Categories.Remove(category); + _context.categorys.Remove(category); await _context.SaveChangesAsync(); } }