﻿@model PagedList.IPagedList<AstroPhotoGallery.Models.Category>
@using PagedList.Mvc;
@using System.Linq;
@{
    ViewBag.Title = "List";
}
<link href="~/Content/PagedList.css" rel="stylesheet" />
<div class="container">
    <h2 class="text-center">Browse by categories</h2>
    <br/>

    @foreach (var category in Model)
    {
        <div class="col-sm-4">
            <div class="thumbnail ">
                @if (category.Pictures.Any(p => p.CategoryId == category.Id))
                {
                    <img src="@Url.Content(category.Pictures.Where(p => p.CategoryId == category.Id).FirstOrDefault().ImagePath)" style="height:190px;width:350px">
                }
                else
                {
                    <img src="~/Content/images/default-gallery-image.jpg" style="height:190px;width:350px" />
                }

                <div class="caption text-center ">
                    <h4>
                        @Html.ActionLink(string.Format($"{category.Name}"),
                                "ListPictures", "Home", new { @categoryId = category.Id }, null)
                    </h4>
                </div>
            </div>
        </div>
    }
</div>


Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount

@Html.PagedListPager(Model, page => Url.Action("ListCategories",
    new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))

﻿@model PagedList.IPagedList<AstroPhotoGallery.Models.Category>
@using PagedList.Mvc;
@using System.Linq;
@{
    ViewBag.Title = "List";
}
<link href="~/Content/PagedList.css" rel="stylesheet" />
<div class="container">
    <h2 class="text-center">Browse by categories</h2>
    <br/>

    @foreach (var category in Model)
    {
        <div class="col-sm-4">
            <div class="thumbnail ">
                @if (category.Pictures.Any(p => p.CategoryId == category.Id))
                {
                    <img src="@Url.Content(category.Pictures.Where(p => p.CategoryId == category.Id).FirstOrDefault().ImagePath)" style="height:190px;width:350px">
                }
                else
                {
                    <img src="~/Content/images/default-gallery-image.jpg" style="height:190px;width:350px" />
                }

                <div class="caption text-center ">
                    <h4>
                        @Html.ActionLink(string.Format($"{category.Name}({category.Pictures.Count})"),
                                "ListPictures", "Home", new { @categoryId = category.Id }, null)                     
                    </h4>
                </div>
            </div>
        </div>
    }
</div>


Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) of @Model.PageCount

@Html.PagedListPager(Model, page => Url.Action("ListCategories",
    new { page, sortOrder = ViewBag.CurrentSort, currentFilter = ViewBag.CurrentFilter }))

Add pictures count of category
Add pictures count of category
