Welcome to mirror list, hosted at ThFree Co, Russian Federation.

MyOrders.razor « Pages « BlazingPizza.Client « wasm - github.com/mono/illinker-test-assets.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7117f9b4d361278250b06d146c12e220553b7074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
@page "/myorders"
@inject HttpClient HttpClient
@attribute [Authorize]

<div class="main">
    <TemplatedList Loader="@LoadOrders" ListGroupClass="orders-list">
        <LoadingContent>Loading...</LoadingContent>
        <EmptyContent>
            <h2>No orders placed</h2>
            <a class="btn btn-success" href="">Order some pizza</a>
        </EmptyContent>
        <ItemContent Context="item">
            <div class="col">
                <h5>@item.Order.CreatedTime.ToLongDateString()</h5>
                Items:
                <strong>@item.Order.Pizzas.Count()</strong>;
                Total price:
                <strong>£@item.Order.GetFormattedTotalPrice()</strong>
            </div>
            <div class="col">
                Status: <strong>@item.StatusText</strong>
            </div>
            <div class="col flex-grow-0">
                <a href="myorders/@item.Order.OrderId" class="btn btn-success">
                    Track &gt;
                </a>
            </div>
        </ItemContent>
    </TemplatedList>
</div>

@functions {
    async Task<List<OrderWithStatus>> LoadOrders()
    {
        return await HttpClient.GetJsonAsync<List<OrderWithStatus>>("orders");
    }
}