@model StudentCreateDto
@{
    ViewData["Title"] = "Add Student";
    var schools = ViewBag.Schools as IEnumerable<SchoolDto>;
}

<h2>Add Student</h2>
<hr />

<div class="row">
    <div class="col-md-6">
        <form asp-action="Create" method="post">
            <div asp-validation-summary="All" class="text-danger"></div>
            <div class="mb-3">
                <label asp-for="ExistingStudentId" class="form-label">Student ID</label>
                <input asp-for="ExistingStudentId" class="form-control" />
            </div>
            <div class="mb-3">
                <label asp-for="FirstName" class="form-label">First Name</label>
                <input asp-for="FirstName" class="form-control" />
                <span asp-validation-for="FirstName" class="text-danger"></span>
            </div>
            <div class="mb-3">
                <label asp-for="LastName" class="form-label">Last Name</label>
                <input asp-for="LastName" class="form-control" />
                <span asp-validation-for="LastName" class="text-danger"></span>
            </div>
            <div class="mb-3">
                <label asp-for="DateOfBirth" class="form-label">Date of Birth</label>
                <input asp-for="DateOfBirth" type="date" class="form-control" />
                <span asp-validation-for="DateOfBirth" class="text-danger"></span>
            </div>
            <div class="mb-3">
                <label asp-for="Sex" class="form-label">Sex</label>
                <select asp-for="Sex" asp-items="Html.GetEnumSelectList<Sex>()" class="form-select"></select>
            </div>
            <div class="mb-3">
                <label asp-for="SchoolId" class="form-label">School</label>
                <select asp-for="SchoolId" class="form-select">
                    <option value="">Select School</option>
                    @if (schools != null) { @foreach (var s in schools) { <option value="@s.SchoolId">@s.Name</option> } }
                </select>
                <span asp-validation-for="SchoolId" class="text-danger"></span>
            </div>
            <button type="submit" class="btn btn-primary">Create</button>
            <a asp-action="Index" class="btn btn-secondary">Cancel</a>
        </form>
    </div>
</div>

@section Scripts { <partial name="_ValidationScriptsPartial" /> }
