Generated MVC Views: Authors/Index.cshtml


Clicking on the tab of the project’s homepage, the view Authors/Index.cshtml will be displayed as follows:


C:\ASP.NET-workspace\BookStore3\Views\Authors\Index.cshtml
 @model IEnumerable<BookStore3.Models.Author>

 @{ ViewData["Title"] = "Index"; }

 <h1>Index</h1>
 <p><a asp-action="Create">Create New</a></p>
 <table class="table">
   <thead>
     <tr>
       <th>@Html.DisplayNameFor( model => model.Name )</th>
       <th>@Html.DisplayNameFor( model => model.Book )</th>
       <th></th>
     </tr>
   </thead>
   <tbody>
     @foreach( var item in Model ) {
       <tr>
         <td>@Html.DisplayFor( modelItem => item.Name )</td>
         <td>@Html.DisplayFor( modelItem => item.Book.Title )</td>
         <td>
           <a asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
           <a asp-action="Details" asp-route-id="@item.Id">Details</a> |
           <a asp-action="Delete" asp-route-id="@item.Id">Delete</a>
         </td>
       </tr>
     }
   </tbody>
 </table>




      A roman walks into a cafe holds up 2 fingers    
      and gets 5 coffees.