39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
// src/Webshop.Api/Controllers/Admin/AdminShippingMethodsController.cs
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using Webshop.Application.DTOs.Shipping;
|
|
using Webshop.Application.Services.Admin;
|
|
|
|
namespace Webshop.Api.Controllers.Admin
|
|
{
|
|
[ApiController]
|
|
[Route("api/v1/admin/shippingmethods")]
|
|
[Authorize(Roles = "Admin")]
|
|
public class AdminShippingMethodsController : ControllerBase
|
|
{
|
|
private readonly IAdminShippingMethodService _shippingMethodService;
|
|
|
|
public AdminShippingMethodsController(IAdminShippingMethodService shippingMethodService)
|
|
{
|
|
_shippingMethodService = shippingMethodService;
|
|
}
|
|
|
|
[HttpPost]
|
|
public async Task<ActionResult<ShippingMethodDto>> CreateShippingMethod([FromBody] ShippingMethodDto shippingMethodDto)
|
|
{
|
|
// Implementierung im AdminShippingMethodService
|
|
var createdMethod = await _shippingMethodService.CreateAsync(shippingMethodDto);
|
|
return CreatedAtAction(nameof(GetShippingMethodById), new { id = createdMethod.Id }, createdMethod);
|
|
}
|
|
|
|
[HttpGet("{id}")]
|
|
public async Task<ActionResult<ShippingMethodDto>> GetShippingMethodById(Guid id)
|
|
{
|
|
// ...
|
|
return Ok();
|
|
}
|
|
}
|
|
} |