I am making a Roster with all different types of employees. I am using a table to display this data where i used to have it so it was displaing the first name of the employees which were the own individual accounts. I instead want to have the roster contain the Id of the employee accounts so i am not relying on the first name only incase there a double ups in names. Unless there is a way to have the ApplicationUser data type in my sql database, I have to have the Id of the employee and then when i want to display the roster, get the first name of employee by the Id. However when i run this code i dont get the first name i get this instead:
Here is the code I have tried so far to display the data:Image of the code running result
@foreach (var day in context.DayOfWeek){<tr><th>@day.Day</th><th>@day.OpenTime</th><th>@day.CloseTime</th><th>@GetNameFromIdAsync(day.Manager1)</th><th>@GetNameFromIdAsync(day.Manager2)</th><th>@GetNameFromIdAsync(day.Kitchen1)</th><th>@GetNameFromIdAsync(day.Kitchen2)</th><th>@GetNameFromIdAsync(day.Kitchen3)</th><th>@GetNameFromIdAsync(day.Driver1)</th><th>@GetNameFromIdAsync(day.Driver2)</th><th>@GetNameFromIdAsync(day.Driver3)</th><AuthorizeView Roles="Administrator"><th><a href="@($"rosterdays/edit?id={day.Id}")"><button class="btn-warning">Edit</button></a></th><th><a href="@($"rosterdays/delete?id={day.Id}")"><button class="btn-danger">Delete</button></a></th></AuthorizeView></tr>}Here is the async task i created:
private async Task<string> GetNameFromIdAsync(string id){ var user = await UserManager.FindByIdAsync(id); if(user != null && user.FirstName != null) { return user.FirstName; } else { return null; }}I am new to blazor and sql so if there is a way i can have ApplicationUser datatype in the database or link the a asp.net user row to column in a seperate table that would be great.