﻿@model Carro

<a class="btn btn-outline-info" asp-area="" asp-controller="Carro" asp-action="Index" role="button">Voltar</a>

<div id="carouselExampleControls" class="carousel slide" data-bs-ride="carousel">
    <div class="bg-dark carousel-inner">
        <div class="carousel-item active">
            <img src="@Html.DisplayFor(Model => Model.url1)" class="rounded mx-auto d-block w-25" alt="...">
        </div>
    </div>
</div>

<div class="card text-center">
    <div class="card-header">
        R$ @Html.DisplayFor(Model => Model.preco),00
    </div>
    <div class="card-body">
        <h5 class="card-title">@Html.DisplayFor(Model => Model.marca) - @Html.DisplayFor(Model => Model.modelo)</h5>
        <p class="card-text">@Html.DisplayFor(Model => Model.descricao).</p>
        <a class="btn btn-outline-info" asp-controller="Carro" asp-action="Update" asp-route-id="@Model.id" role="button">Atualizar</a>
        <a class="btn btn-outline-dark" asp-controller="Carro" asp-action="Confirm" asp-route-id="@Model.id" role="button">Exclur</a>
    </div>
    <div class="card-footer text-muted">
        @Html.DisplayFor(Model => Model.ano)
    </div>
</div>

@if (Model.testes.Count > 0)
{
    <b>Agendamentos de teste para este carro:</b>
    <table class="table table-striped">
        <thead>
            <tr>
                <th scope="col">#</th>
                <th scope="col">Nome</th>
                <th scope="col">Telefone</th>
                <th scope="col">Negociação</th>
            </tr>
        </thead>
        @foreach (TesteDrive t in Model.testes)
        {
            <tbody>
                <tr>
                    <th scope="row">@Html.DisplayFor(Model => t.id)</th>
                    <td>@Html.DisplayFor(Model => t.nome)</td>
                    <td>@Html.DisplayFor(Model => t.celular)</td>
                    <td>@Html.DisplayFor(Model => t.tipo)</td>
                </tr>
            </tbody>
        }
    </table>
}
