Razor

De Banane Atomic
Aller à la navigationAller à la recherche

Variable

Razor.svg
<div>@Employee.Name</div>
<div>@Employee.BirthDate?.ToShortDateString()</div>
<a href="@($"employee/{Employee.EmployeeId}")" />

if / else

Razor.svg
@if (MyVar == null)
{
    <p><em>Loading...</em></p>
}
else
{
    <h2>Values:</h2>
}

foreach

Razor.svg
<table class="table">
    <tbody>
        @foreach (var employee in Employees)
        {
        <tr>
            <td>@employee.Name</td>
        </tr>
        }
    </tbody>
</table>