Using Strongly Typed Views (2)

We have already updated our Model class, now we want to call it in View class.

Add a callback inside view class, to link it with Model class on the top of code.

@model ComicBookGallery.Models.ComicBook

Then, change our ViewBag to Model. Do it to all elements.

ViewBag.Title = Model.DisplayText;

<h1>@Model.SeriesTitle </h1>

And, don't forget with Artist elements.

@foreach (var artist in Model.Artists)
{
    <li>@artist.Role : @artist.Name</li>
}

results matching ""

    No results matching ""