I want to send requests to the API from the UI with Blazor .Net Core
This is how I do on the UI:
@code {
OrderDto orderDto = new();
protected override async Task OnInitializedAsync()
{
var urlString = "myUrlString";
var orderListResponse = await urlString.PostJsonAsync(orderDto);
}
}
And that’s my API part:
[Route("getOrderList")]
[HttpPost]
public async Task<ActionResult<List<OrderDto>>> GetOrderList(OrderDto orderDto)
{
var response = await _orderService.OrderList(orderDto);
return response;
}
I can get the data from _orderService but when I come to flurl’s response, I get the 500 error and I don’t understand why it gives this error.
New contributor
Derya Öztürk is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1