@page "/"
@using Models
@using Services
@inject IRentService RentService

<PageTitle>Home</PageTitle>

<h1>Available Vehicles</h1>

<table class="table table-striped">
    <thead>
        <tr>
            <td>ID</td>
            <td>Brand</td>
            <td>Model</td>
            <td>LicencePlate</td>
            <td>Category</td>
            <td>PricePerDay</td>
            <td>Location</td>
            <td>LocationAddress</td>
            <td>Status</td>
        </tr>
    </thead>
    <tbody>
        @foreach (Vehicle v in _vehicles)
        {
            <tr>
                <td>@v.Id</td>
                <td>@v.Brand</td>
                <td>@v.Model</td>
                <td>@v.LicencePlate</td>
                <td>@v.Category</td>
                <td>@v.PricePerDay</td>
                <td>@v.Location</td>
                <td>@v.LocationAddress</td>
                <td>@v.Status</td>
            </tr>
        }
    </tbody>
</table>


@code {
    private List<Vehicle> _vehicles = new List<Vehicle>();

    protected override void OnInitialized()
    {
        _vehicles = RentService.GetAvailableCars();
        Console.WriteLine("VC" +  _vehicles.Count);
        @* return Task.CompletedTask; *@
    }

}
