éxample values

This commit is contained in:
Tizian.Breuch
2025-08-01 15:34:43 +02:00
parent 60e8ea073e
commit c363c6a6a7
3 changed files with 13 additions and 11 deletions

View File

@@ -12,26 +12,26 @@ namespace Webshop.Api.Controllers.Admin
[ApiController]
[Route("api/v1/admin/[controller]")]
[Authorize(Roles = "Admin")]
public class AdmincategoriesController : ControllerBase
public class AdminCategoriesController : ControllerBase
{
private readonly IAdminCategorieService _admincategorieservice;
private readonly IAdminCategorieService _adminCategorieService;
public AdmincategoriesController(IAdminCategorieService admincategorieservice)
public AdminCategoriesController(IAdminCategorieService admincategorieservice)
{
_admincategorieservice = admincategorieservice;
_adminCategorieService = admincategorieservice;
}
[HttpGet]
public async Task<ActionResult<IEnumerable<CategorieDto>>> GetAllcategories()
{
var categories = await _admincategorieservice.GetAllAsync();
var categories = await _adminCategorieService.GetAllAsync();
return Ok(categories);
}
[HttpGet("{id}")]
public async Task<ActionResult<CategorieDto>> GetcategorieById(Guid id)
{
var categorie = await _admincategorieservice.GetByIdAsync(id);
var categorie = await _adminCategorieService.GetByIdAsync(id);
if (categorie == null) return NotFound();
return Ok(categorie);
}
@@ -41,7 +41,7 @@ namespace Webshop.Api.Controllers.Admin
{
if (!ModelState.IsValid) return BadRequest(ModelState);
var (createdcategorie, errorMessage) = await _admincategorieservice.CreateAsync(categorieDto);
var (createdcategorie, errorMessage) = await _adminCategorieService.CreateAsync(categorieDto);
if (createdcategorie == null)
{
@@ -56,7 +56,7 @@ namespace Webshop.Api.Controllers.Admin
{
if (!ModelState.IsValid) return BadRequest(ModelState);
var (success, errorMessage) = await _admincategorieservice.UpdateAsync(id, categorieDto);
var (success, errorMessage) = await _adminCategorieService.UpdateAsync(id, categorieDto);
if (!success)
{
@@ -69,7 +69,7 @@ namespace Webshop.Api.Controllers.Admin
[HttpDelete("{id}")]
public async Task<IActionResult> Deletecategorie(Guid id)
{
var success = await _admincategorieservice.DeleteAsync(id);
var success = await _adminCategorieService.DeleteAsync(id);
if (!success) return NotFound();
return NoContent();
}