« Razor » : différence entre les versions

De Banane Atomic
Aller à la navigationAller à la recherche
Aucun résumé des modifications
Ligne 4 : Ligne 4 :
<div>@Employee.Name</div>
<div>@Employee.Name</div>
<div>@Employee.BirthDate?.ToShortDateString()</div>
<div>@Employee.BirthDate?.ToShortDateString()</div>
<a href="@($"http://site.domain.fr/employee/{Employee.EmployeeId}")" />
<a href="@($"employee/{Employee.EmployeeId}")" />
</kode>
</kode>



Version du 10 janvier 2020 à 21:14

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>