@page "/students/create"
@attribute [Authorize]
@using WebApp.Components.Shared.Components
@inject AppDbContext Context
@inject NavigationManager NavigationManager
Create
Cancel
@code {
[SupplyParameterFromForm]
private Student Student { get; set; } = new() { TsaYear = 1 };
private void OnValidSubmit(EditContext context)
{
Context.Students.Add(Student);
Context.SaveChanges();
NavigationManager.NavigateTo("/students");
}
}