test bilder erneut
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
// Auto-generiert von CreateWebshopFiles.ps1
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
// src/Webshop.Api/Controllers/Admin/AdminProductsController.cs
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
using Microsoft.AspNetCore.Http; // F<>r IFormFile
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Webshop.Application.DTOs.Products;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Webshop.Application.Services.Admin.Interfaces;
|
||||
|
||||
namespace Webshop.Api.Controllers.Admin
|
||||
@@ -39,25 +38,15 @@ namespace Webshop.Api.Controllers.Admin
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Consumes("multipart/form-data")]
|
||||
public async Task<ActionResult<AdminProductDto>> CreateAdminProduct([FromForm] CreateAdminProductDto productDto) // << NEU: [FromForm] und CreateAdminProductDto >>
|
||||
public async Task<ActionResult<AdminProductDto>> CreateAdminProduct([FromBody] CreateAdminProductDto productDto) // << ZUR<55>CK ZU [FromBody] >>
|
||||
{
|
||||
if (!ModelState.IsValid) return BadRequest(ModelState);
|
||||
|
||||
var createdProduct = await _adminProductService.CreateAdminProductAsync(productDto);
|
||||
|
||||
if (createdProduct == null)
|
||||
{
|
||||
// Hier k<>nnte eine spezifischere Fehlermeldung vom Service kommen
|
||||
return BadRequest("Produkt konnte nicht erstellt werden.");
|
||||
}
|
||||
|
||||
return CreatedAtAction(nameof(GetAdminProduct), new { id = createdProduct.Id }, createdProduct);
|
||||
}
|
||||
|
||||
|
||||
[HttpPut("{id}")]
|
||||
public async Task<IActionResult> UpdateAdminProduct(Guid id, [FromBody] UpdateAdminProductDto productDto)
|
||||
public async Task<IActionResult> UpdateAdminProduct(Guid id, [FromBody] UpdateAdminProductDto productDto) // << ZUR<55>CK ZU [FromBody] >>
|
||||
{
|
||||
if (id != productDto.Id) return BadRequest();
|
||||
if (!ModelState.IsValid) return BadRequest(ModelState);
|
||||
@@ -66,6 +55,7 @@ namespace Webshop.Api.Controllers.Admin
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> DeleteAdminProduct(Guid id)
|
||||
{
|
||||
@@ -74,4 +64,4 @@ namespace Webshop.Api.Controllers.Admin
|
||||
return NoContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ using Webshop.Domain.Identity;
|
||||
using Webshop.Domain.Interfaces;
|
||||
using Webshop.Infrastructure.Data;
|
||||
using Webshop.Infrastructure.Repositories;
|
||||
using Webshop.Infrastructure.Services;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@@ -108,6 +109,7 @@ builder.Services.AddScoped<IOrderService, OrderService>();
|
||||
builder.Services.AddScoped<IAddressService, AddressService>();
|
||||
builder.Services.AddScoped<ICheckoutService, CheckoutService>();
|
||||
builder.Services.AddScoped<IReviewService, ReviewService>();
|
||||
builder.Services.AddScoped<IFileStorageService, LocalFileStorageService>();
|
||||
|
||||
|
||||
// Externe Dienste (Resend)
|
||||
|
||||
Reference in New Issue
Block a user