I am working on a Blazor Server web application. I have an SQL Server Database and Entity Framework.
Look at this Entity:
public class Room
{
public int Id {get;set;}
public String name {get;set;}
public DateTime closing_date {get;set;}
}
I want to display Room table content on a razor page:
<Virtualize Items="@rooms" Context="room">
<table border="1">
<tr @key=room.Id>
<td>@room.Id</td>
<td>@room.Name</td>
<td>Closing in XXX minutes and YYY seconds</td>
</tr>
</table>
</Virtualize>
As you can see, i don't want to display the closing date/time. I want to compute how many minutes are remaining before closing.
I can easily calculate XXX and YYY values. This is easy. What i want to do is to refresh values each seconds. How can i do that ?
In a classic web application i would create a javascript timer with setInterval for example. How can i do that in a blazor server project ?
Thanks