naming
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
// src/Webshop.Api/Controllers/Admin/AdmincategorysController.cs
|
||||
// src/Webshop.Api/Controllers/Admin/AdmincategoriesController.cs
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Application.DTOs.Categorys;
|
||||
using Webshop.Application.DTOs.categories;
|
||||
using Webshop.Application.Services.Admin;
|
||||
|
||||
namespace Webshop.Api.Controllers.Admin
|
||||
@@ -12,51 +12,51 @@ namespace Webshop.Api.Controllers.Admin
|
||||
[ApiController]
|
||||
[Route("api/v1/admin/[controller]")]
|
||||
[Authorize(Roles = "Admin")]
|
||||
public class AdminCategorysController : ControllerBase
|
||||
public class AdmincategoriesController : ControllerBase
|
||||
{
|
||||
private readonly IAdminCategoryService _adminCategoryService;
|
||||
private readonly IAdminCategorieService _admincategorieservice;
|
||||
|
||||
public AdminCategorysController(IAdminCategoryService adminCategoryService)
|
||||
public AdmincategoriesController(IAdminCategorieService admincategorieservice)
|
||||
{
|
||||
_adminCategoryService = adminCategoryService;
|
||||
_admincategorieservice = admincategorieservice;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<IEnumerable<CategoryDto>>> GetAllcategorys()
|
||||
public async Task<ActionResult<IEnumerable<categorieDto>>> GetAllcategories()
|
||||
{
|
||||
var categorys = await _adminCategoryService.GetAllAsync();
|
||||
return Ok(categorys);
|
||||
var categories = await _admincategorieservice.GetAllAsync();
|
||||
return Ok(categories);
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
public async Task<ActionResult<CategoryDto>> GetCategoryById(Guid id)
|
||||
public async Task<ActionResult<categorieDto>> GetcategorieById(Guid id)
|
||||
{
|
||||
var category = await _adminCategoryService.GetByIdAsync(id);
|
||||
if (category == null) return NotFound();
|
||||
return Ok(category);
|
||||
var categorie = await _admincategorieservice.GetByIdAsync(id);
|
||||
if (categorie == null) return NotFound();
|
||||
return Ok(categorie);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<CategoryDto>> CreateCategory([FromBody] CreateCategoryDto categoryDto)
|
||||
public async Task<ActionResult<categorieDto>> Createcategorie([FromBody] CreatecategorieDto categorieDto)
|
||||
{
|
||||
if (!ModelState.IsValid) return BadRequest(ModelState);
|
||||
|
||||
var (createdCategory, errorMessage) = await _adminCategoryService.CreateAsync(categoryDto);
|
||||
var (createdcategorie, errorMessage) = await _admincategorieservice.CreateAsync(categorieDto);
|
||||
|
||||
if (createdCategory == null)
|
||||
if (createdcategorie == null)
|
||||
{
|
||||
return BadRequest(new { Message = errorMessage });
|
||||
}
|
||||
|
||||
return CreatedAtAction(nameof(GetCategoryById), new { id = createdCategory.Id }, createdCategory);
|
||||
return CreatedAtAction(nameof(GetcategorieById), new { id = createdcategorie.Id }, createdcategorie);
|
||||
}
|
||||
|
||||
[HttpPut("{id}")]
|
||||
public async Task<IActionResult> UpdateCategory(Guid id, [FromBody] CreateCategoryDto categoryDto)
|
||||
public async Task<IActionResult> Updatecategorie(Guid id, [FromBody] CreatecategorieDto categorieDto)
|
||||
{
|
||||
if (!ModelState.IsValid) return BadRequest(ModelState);
|
||||
|
||||
var (success, errorMessage) = await _adminCategoryService.UpdateAsync(id, categoryDto);
|
||||
var (success, errorMessage) = await _admincategorieservice.UpdateAsync(id, categorieDto);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
@@ -67,9 +67,9 @@ namespace Webshop.Api.Controllers.Admin
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> DeleteCategory(Guid id)
|
||||
public async Task<IActionResult> Deletecategorie(Guid id)
|
||||
{
|
||||
var success = await _adminCategoryService.DeleteAsync(id);
|
||||
var success = await _admincategorieservice.DeleteAsync(id);
|
||||
if (!success) return NotFound();
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// src/Webshop.Api/Controllers/Public/categorysController.cs
|
||||
// src/Webshop.Api/Controllers/Public/categoriesController.cs
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Application.DTOs.Categorys;
|
||||
using Webshop.Application.DTOs.categories;
|
||||
using Webshop.Application.Services.Public;
|
||||
|
||||
namespace Webshop.Api.Controllers.Public
|
||||
@@ -11,28 +11,28 @@ namespace Webshop.Api.Controllers.Public
|
||||
[ApiController]
|
||||
[Route("api/v1/public/[controller]")]
|
||||
[AllowAnonymous]
|
||||
public class CategoryController : ControllerBase
|
||||
public class categorieController : ControllerBase
|
||||
{
|
||||
private readonly ICategoryService _categoryService;
|
||||
private readonly ICategorieService _categorieservice;
|
||||
|
||||
public CategoryController(ICategoryService categoryService)
|
||||
public categorieController(ICategorieService categorieservice)
|
||||
{
|
||||
_categoryService = categoryService;
|
||||
_categorieservice = categorieservice;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<IEnumerable<CategoryDto>>> GetActivecategorys()
|
||||
public async Task<ActionResult<IEnumerable<categorieDto>>> GetActivecategories()
|
||||
{
|
||||
var categorys = await _categoryService.GetAllActiveAsync();
|
||||
return Ok(categorys);
|
||||
var categories = await _categorieservice.GetAllActiveAsync();
|
||||
return Ok(categories);
|
||||
}
|
||||
|
||||
[HttpGet("{slug}")]
|
||||
public async Task<ActionResult<CategoryDto>> GetCategoryBySlug(string slug)
|
||||
public async Task<ActionResult<categorieDto>> GetcategorieBySlug(string slug)
|
||||
{
|
||||
var category = await _categoryService.GetBySlugAsync(slug);
|
||||
if (category == null) return NotFound();
|
||||
return Ok(category);
|
||||
var categorie = await _categorieservice.GetBySlugAsync(slug);
|
||||
if (categorie == null) return NotFound();
|
||||
return Ok(categorie);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ builder.Services.AddScoped<IProductRepository, ProductRepository>();
|
||||
builder.Services.AddScoped<ISupplierRepository, SupplierRepository>();
|
||||
builder.Services.AddScoped<ICustomerRepository, CustomerRepository>();
|
||||
builder.Services.AddScoped<IPaymentMethodRepository, PaymentMethodRepository>();
|
||||
builder.Services.AddScoped<ICategoryRepository, CategoryRepository>();
|
||||
builder.Services.AddScoped<IcategorieRepository, categorieRepository>();
|
||||
builder.Services.AddScoped<IOrderRepository, OrderRepository>();
|
||||
builder.Services.AddScoped<IShippingMethodRepository, ShippingMethodRepository>();
|
||||
builder.Services.AddScoped<IAddressRepository, AddressRepository>();
|
||||
@@ -91,12 +91,12 @@ builder.Services.AddScoped<ISettingRepository, SettingRepository>();
|
||||
builder.Services.AddScoped<IAuthService, AuthService>();
|
||||
builder.Services.AddScoped<IProductService, ProductService>();
|
||||
builder.Services.AddScoped<IPaymentMethodService, PaymentMethodService>();
|
||||
builder.Services.AddScoped<ICategoryService, CategoryService>();
|
||||
builder.Services.AddScoped<ICategorieService, CategorieService>();
|
||||
builder.Services.AddScoped<IAdminUserService, AdminUserService>();
|
||||
builder.Services.AddScoped<IAdminProductService, AdminProductService>();
|
||||
builder.Services.AddScoped<IAdminSupplierService, AdminSupplierService>();
|
||||
builder.Services.AddScoped<IAdminPaymentMethodService, AdminPaymentMethodService>();
|
||||
builder.Services.AddScoped<IAdminCategoryService, AdminCategoryService>();
|
||||
builder.Services.AddScoped<IAdminCategorieService, AdminCategorieService>();
|
||||
builder.Services.AddScoped<IAdminOrderService, AdminOrderService>();
|
||||
builder.Services.AddScoped<IAdminShippingMethodService, AdminShippingMethodService>();
|
||||
builder.Services.AddScoped<IAdminDiscountService, AdminDiscountService>();
|
||||
|
||||
@@ -6,7 +6,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Webshop.Application.DTOs;
|
||||
using Webshop.Application.DTOs.Auth;
|
||||
using Webshop.Application.DTOs.Categorys;
|
||||
using Webshop.Application.DTOs.categories;
|
||||
using Webshop.Application.DTOs.Customers;
|
||||
using Webshop.Application.DTOs.Discounts;
|
||||
using Webshop.Application.DTOs.Email;
|
||||
@@ -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}"),
|
||||
["categorys"] = new OpenApiArray
|
||||
["categories"] = new OpenApiArray
|
||||
{
|
||||
new OpenApiObject
|
||||
{
|
||||
@@ -146,19 +146,19 @@ namespace Webshop.Api.SwaggerFilters
|
||||
["lastModifiedDate"] = new OpenApiNull(),
|
||||
["supplierId"] = new OpenApiNull(),
|
||||
["purchasePrice"] = new OpenApiDouble(80.00),
|
||||
["categoryIds"] = new OpenApiArray { new OpenApiString("EXISTING_CATEGORY_ID_HERE") }
|
||||
["categorieIds"] = new OpenApiArray { new OpenApiString("EXISTING_categorie_ID_HERE") }
|
||||
};
|
||||
}
|
||||
// --- Kategorien ---
|
||||
else if (type == typeof(CreateCategoryDto))
|
||||
else if (type == typeof(CreatecategorieDto))
|
||||
{
|
||||
schema.Example = new OpenApiObject
|
||||
{
|
||||
["name"] = new OpenApiString($"Neue Kategorie {uniqueId}"),
|
||||
["slug"] = new OpenApiString($"neue-kategorie-{uniqueId}"),
|
||||
["description"] = new OpenApiString("Eine Beschreibung für die neue Kategorie."),
|
||||
["parentCategoryId"] = new OpenApiNull(),
|
||||
["imageUrl"] = new OpenApiString("https://example.com/images/new_category.jpg"),
|
||||
["parentcategorieId"] = new OpenApiNull(),
|
||||
["imageUrl"] = new OpenApiString("https://example.com/images/new_categorie.jpg"),
|
||||
["isActive"] = new OpenApiBoolean(true),
|
||||
["displayOrder"] = new OpenApiInteger(1)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user