Update order controller
This commit is contained in:
@@ -21,7 +21,7 @@ public class OrderController(OrderService service) : ControllerBase
|
||||
public async Task<IActionResult> GetByStore(Guid storeId)
|
||||
{
|
||||
var result = await service.GetByStoreIdAsync(storeId);
|
||||
return result is null ? Forbid() : Ok(result);
|
||||
return result is null ? StatusCode(StatusCodes.Status403Forbidden) : Ok(result);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -30,7 +30,7 @@ public class OrderController(OrderService service) : ControllerBase
|
||||
try
|
||||
{
|
||||
var result = await service.CreateAsync(request, ct);
|
||||
return result is null ? Forbid() : CreatedAtAction(nameof(GetById), new { id = result.Id }, result);
|
||||
return result is null ? StatusCode(StatusCodes.Status403Forbidden) : CreatedAtAction(nameof(GetById), new { id = result.Id }, result);
|
||||
}
|
||||
catch (InvalidOperationException ex) { return BadRequest(new { error = ex.Message }); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user