@using Zap.BI.Core.Security.Diagnostics
@using Zap.BI.Portal.Pages.Diagnostics
@using Zap.Collections
@model Zap.BI.Portal.Models.Diagnostics.PrincipalListModel

@{
    Layout = null;
}

@if (Model.Principals != null) 
{
    if (Model.Principals.None())
    {
        <br/><b>- @DiagnosticText.ADDiagnostics_NoResults -</b><br/>
    }
    else
    {
        <table>
            <tr>
                <th>@DiagnosticText.ADDiagnostics_Name</th>
                <th>@DiagnosticText.ADDiagnostics_Principal_DisplayName</th>
                <th>@DiagnosticText.ADDiagnostics_Principal_DistinguishedName</th>
                <th>@DiagnosticText.ADDiagnostics_Principal_SamAccountName</th>
                <th>@DiagnosticText.ADDiagnostics_Principal_Sid</th>
                <th>@DiagnosticText.ADDiagnostics_ContextName</th>
            </tr>
            @foreach (PrincipalModel principal in Model.Principals.OrderBy(p => p.Name))
            { 
                <tr>
                    <td>@principal.Name</td>
                    <td>@principal.DisplayName</td>
                    <td>@principal.DistinguishedName</td>
                    <td>@principal.SamAccountName</td>
                    <td>@principal.Sid</td>
                    <td>@principal.ContextName</td>
                </tr>
            }
        </table>
        if (Model.Principals.Count() > 1)
        {
            <p><b>[@Model.Principals.Count()]</b></p>
        }
    }
}
<br/>