You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.5 KiB
56 lines
1.5 KiB
@using BWPMModels;
|
|
|
|
<RadzenDropDown AllowClear="true" TValue="string" @bind-Value=@LehrerID
|
|
Data=@intLehrer
|
|
Change=@(args => OnChange(args, "DropDown")) TextProperty="bezeichnung" ValueProperty="id" />
|
|
|
|
@code {
|
|
[Parameter]
|
|
public EventCallback<string> OnLehrerChanged { get; set; }
|
|
|
|
public string LehrerID;
|
|
public List<iLehrer> intLehrer = new List<iLehrer>();
|
|
public List<BWPMModels.Lehrer> Lehrer { get; set; } = BlazorApp.Controller.LehrerController.GetAllActiveData();
|
|
|
|
public class iLehrer
|
|
{
|
|
public string id { get; set; }
|
|
public string bezeichnung { get; set; }
|
|
}
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
Lehrer = BlazorApp.Controller.LehrerController.GetAllActiveData();
|
|
intLehrer.Clear();
|
|
foreach (BWPMModels.Lehrer item in Lehrer)
|
|
{
|
|
iLehrer ll = new iLehrer();
|
|
ll.id = item.ID.ToString();
|
|
ll.bezeichnung = item.name.ToString() + " " + item.vorname.ToString();
|
|
intLehrer.Add(ll);
|
|
}
|
|
LehrerID = Lehrer[0].ID.ToString();
|
|
}
|
|
|
|
|
|
public Task OnChange(object value, string name)
|
|
{
|
|
try
|
|
{
|
|
LehrerID = value.ToString();
|
|
return OnLehrerChanged.InvokeAsync(LehrerID);
|
|
}
|
|
catch
|
|
{
|
|
return OnLehrerChanged.InvokeAsync("0");
|
|
|
|
}
|
|
}
|
|
|
|
public string GetLehrerID()
|
|
{
|
|
return LehrerID;
|
|
}
|
|
|
|
}
|