adress und migration
This commit is contained in:
@@ -24,7 +24,6 @@ namespace Webshop.Api.Controllers.Admin
|
||||
[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);
|
||||
}
|
||||
@@ -32,8 +31,33 @@ namespace Webshop.Api.Controllers.Admin
|
||||
[HttpGet("{id}")]
|
||||
public async Task<ActionResult<ShippingMethodDto>> GetShippingMethodById(Guid id)
|
||||
{
|
||||
// ...
|
||||
return Ok();
|
||||
var method = await _shippingMethodService.GetByIdAsync(id);
|
||||
if (method == null) return NotFound();
|
||||
return Ok(method);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<IEnumerable<ShippingMethodDto>>> GetAllShippingMethods()
|
||||
{
|
||||
var methods = await _shippingMethodService.GetAllAsync();
|
||||
return Ok(methods);
|
||||
}
|
||||
|
||||
[HttpPut("{id}")]
|
||||
public async Task<IActionResult> UpdateShippingMethod(Guid id, [FromBody] ShippingMethodDto shippingMethodDto)
|
||||
{
|
||||
if (id != shippingMethodDto.Id) return BadRequest();
|
||||
var success = await _shippingMethodService.UpdateAsync(shippingMethodDto);
|
||||
if (!success) return NotFound();
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> DeleteShippingMethod(Guid id)
|
||||
{
|
||||
var success = await _shippingMethodService.DeleteAsync(id);
|
||||
if (!success) return NotFound();
|
||||
return NoContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user