@model IEnumerable<Yavsc.Models.Blog>
@{
    ViewData["Title"] = "Index";
    
}

<h2>Index</h2>
<p class="text-success">@ViewData["StatusMessage"]</p>
<p>
    <a asp-action="Create">@SR["Create a new article"]</a>
</p>
<table class="table">
    <tr>
        <th colspan="3">
            @SR[Html.DisplayNameFor(model => model.Title)]
        </th>
    </tr>
    
@foreach (var item in Model) {
    <tr>
        <td>
       @Html.DisplayFor(modelItem => item.Photo)
           <markdown>@item.Title</markdown>
        </td>
        <td>
            <span style="font-size:x-small;"> @item.Author.UserName </span> <br>
            <span style="font-size:xx-small;">
            posté le @item.Posted.ToString("dddd d MMM yyyy à H:mm")
            @if ((item.Modified - item.Posted).Minutes > 10){ 
                @:- Modifié le @item.Modified.ToString("dddd d MMM yyyy à H:mm")
             }
            </span>
        </td>
        <td> 
            <ul class="actiongroup">
                <li><a asp-action="Details" asp-route-id="@item.Id">Details</a>
            </li>
            @if (await AuthorizationService.AuthorizeAsync(User, item, new EditRequirement())) {
            <li><a asp-action="Edit" asp-route-id="@item.Id">@SR["Edit"]</a>
            </li>
            <li><a asp-action="Delete" asp-route-id="@item.Id">@SR["Delete"]</a>
            </li>
            }
            </ul>
        </td>
    </tr>
}
</table>



