Finishing the List View

Go to our new View class.

Because we need an input as an array of comic books, we have to declare in the beginning of the class.

@model ComicBookGallery.Models.ComicBook[]

@{
    ViewBag.Title = "Comic Books";
}

<h2>ViewBag.Title</h2>

We have given a layout from designer team,

<div class="row">
    <div class="col-md-3">
        <h4>The Amazing Spider-Man #700</h4>
        <img src="/Images/the-amazing-spider-man-700.jpg" 
            alt="The Amazing Spider-Man #700" 
            class="img-responsive" />
    </div>
</div>

Try to change the code above, so it could use our repository class.

<div class="row">
        @foreach (var comicBook in Model)
        {
            <div class="col-md-3">
                <h4>@comicBook.DisplayText</h4>
                <img src="/Images/@comicBook.CoverImageFileName"
                     alt="@comicBook.DisplayText"
                     class="img-responsive" />
            </div>
        }
</div>

results matching ""

    No results matching ""