@model IEnumerable<TFC.Models.User>

@{
    ViewBag.Title = "Usuarios";
}

<h2>Usuarios</h2>
<p> @Html.ActionLink("Nuevo cliente", "RegisterClient", "User", new {@class="small button" }) | @Html.ActionLink("Nuevo entrenador", "RegisterTrainer", "User",  new {@class="small button" }) | @Html.ActionLink("Nuevo administrador", "RegisterAdmin","User",  new {@class="small button" })</p>

<p>

    
</p>
<p>

    
</p>

<table style="margin-left:auto; margin-right:auto; margin-top:60px;">
    <tr>
        <th>
            Alias
        </th>
        
        <th>
            Nombre
        </th>
        <th>
            Apellidos
        </th>
        <th>
            Email
        </th>
        <th>Rol</th>
        <th></th>
    </tr>
    
@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Username)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.FirstName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.LastName)
        </td>
         <td>
            @Html.DisplayFor(modelItem => item.Email)
        </td>
        <td>@foreach (String s in new CodeFirstRoleProvider().GetRolesForUser(item.Username)) { @Html.Label(s); }

            
        </td>
        <td>
            @Html.ActionLink("Editar", "Edit", new { id=item.UserId}, new {@class="small button" }) |
            @Html.ActionLink("Detalles", "Details", new { id = item.UserId }, new { @class = "small button" }) |
            @Html.ActionLink("Borrar", "Delete", new { id=item.UserId }, new {@class="small button" })
        </td>
    </tr>
}

</table>
