Adding Genre View

As we did in previous projects. In index view, we need to catch the model that being thrown from controller.

@model IEnumerable<PlaylistGenreMvc.Models.GenreModel>

There are many ways to implement the query result, one of them is by using table properties in HTML.

To retrieve the items in the collection, we just perform simple foreach looping.

<table>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th></th>
    </tr>
    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
        </tr>
    }
</table>

results matching ""

    No results matching ""