我正在用 ASP.NET Core MVC 编写“课程”应用程序。当我尝试应用任何课程时,它不会返回任何值SelectedCourse
。我试过
<input id "mvc1" type="radio" asp-for="SelectedCourse"value="ASP.NET Core MVC" checked="true" />
但它不起作用。
Apply.cshtml
:
<div>
<fieldset></fieldset>
<legend>Select One(1) Course</legend>
<p>
<input id "mvc1" type="radio" asp-for="SelectedCourse"value="ASP.NET Core MVC" checked="true" />
<label>ASP.NET Core MVC</label>
</p>
<p>
<input id "mvc2" type="radio" asp-for="SelectedCourse" value="Blazor" />
<label>Blazor</label>
</p>
<p>
<input id "mvc3" type="radio" asp-for="SelectedCourse"value="API" />
<label>Api</label>
</p>
</div>
Repository.cs
:
namespace BTK_Akademi.Models
{
public static class Repository
{
private static List<Candidate> applications = new();
//Listenin dışardan düzenlenmemesi lazım yani readonly olacak
public static IEnumerable<Candidate> Applications => applications;
public static void Add(Candidate candidate)
{
applications.Add(candidate);
}
}
}