Standart Kategori Sayfası +++

Kategori

@inherits System.Web.Mvc.WebViewPage<IEnumerable<Discus.Models.Post>>
@using System.Web.Helpers;
@using System.Web.Mvc;
@using Discus.Models;
@using Discus.Controllers;
@{
    string lang = ViewBag.LanguageShortName;
    Category category = ViewBag.Category as Category;

    int ustID = category.RefCategoryID ?? 0;
    Category ustCategory = Partial.Category(ustID);

    int Categorysay = Partial.CategorySubID(category.CategoryID).Count();
    int Postsay = ViewData.Model.Count();

    DateTime sontarih = DateTime.Now;
    foreach (Post tarih in ViewData.Model.OrderByDescending(m => m.PostUpdateDate).Skip(0).Take(1))
    {
        sontarih = tarih.PostUpdateDate;
    }

    string duvardakiresmine = "";

    if(!String.IsNullOrEmpty(category.CategoryImage))
    {
    duvardakiresmine = category.CategoryImage;
    }
    else if(ustCategory!=null && !String.IsNullOrEmpty(ustCategory.CategoryImage))

    {
    duvardakiresmine = ustCategory.CategoryImage;
    }
    else
    {
    duvardakiresmine = "/Upload/File/placeholder.jpg";
    }
}

<div class="jumbotron jumbotron-fluid">
    <div class="container">
        <h1 class="display-4 text-center">@category.CategoryTitle.HtmlEncode()</h1>
        <div class="text-center">
            <nav aria-label="breadcrumb" style="display:inline-block;">
                @{ int breadcrumbcount = 2;}
                <ol class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList">
                    <li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
                        <a itemprop="item" href="@Partial.SiteAddress()@lang"><span itemprop="name">@Partial.Translate("Anasayfa", lang)</span></a>
                        <meta itemprop="position" content="1" />
                    </li>
                    @foreach (Category kat in Partial.BreadcrumbCategory(category.CategoryID))
                    {
                        <li class="breadcrumb-item active" aria-current="page" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
                            <a itemprop="item" href="@Partial.CategoryLink(kat.CategoryID)"><span itemprop="name">@kat.CategoryTitle.Replace("<br />", " ").HtmlEncode()</span></a>
                            <meta itemprop="position" content="@(breadcrumbcount)" />
                        </li>
                        breadcrumbcount++;
                    }
                </ol>
            </nav>
        </div>
    </div>
</div>

<style>
h5 {
    font-size: 1.19rem;
}
.card{
    height:100%;
}

  .kanvas {
    width: 100%;
    min-height: 250px;
    max-height: 250px;
    overflow: hidden;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    padding-bottom:5px;
}

  .discus-card {
    position: relative;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-direction: column;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 1px solid #d2d2d2;
}
</style>

<div class="container">
                <div class="row galerirow text-center">
                    <div class="col-md-12">
                        @MvcHtmlString.Create(category.CategoryContent)
                    </div>
                </div>
                        @{
                            IEnumerable<Post> Postler = ViewData.Model;
                            int Postdon = Convert.ToInt32(Math.Ceiling(Postler.Count() / Convert.ToDouble(3)));

                            for (int i = 0; i < Postdon; i++)
                            {
                                <div class="row">
                                    @foreach (Post Postm in Postler.Skip(i * 3).Take(3))
                                    {
                                        string Postkapak = "";
                                        if (!String.IsNullOrEmpty(Postm.PostThumbnail))
                                        {
                                            Postkapak = Postm.PostThumbnail;
                                        }
                                        else
                                        {
                                            Postkapak = "/Upload/File/placeholder.jpg";
                                        }


                                        <div class="col-md-4 mb-4">
                                            <div class="discus-card mt-4">
                                                <div class="kanvas mb-2" style="background-image:url(@Postm.PostThumbnail);"></div>
                                                <div class="card-body text-center mt-2">
                                                    <h2>@Postm.PostTitle.HtmlEncode()</h2>
                                                    <p class="card-text">@Partial.PostShortContent(Postm.PostID, 150)</p>
                                                </div>
                                                <div class="about-content text-center mb-3">
                                                    <a href="@Partial.PostLink(Postm.PostID)" class="readmore-btn" tabindex="0">@Partial.Translate("Devami", lang)</a>
                                                </div>
                                            </div>
                                        </div>
                                    }
                                </div>
                            }
                            IEnumerable<Category> Categoryler = Partial.CategorySubID(category.CategoryID);
                            int Categorydon = Convert.ToInt32(Math.Ceiling(Categoryler.Count() / Convert.ToDouble(3)));
                            for (int i = 0; i < Categorydon; i++)
                            {
                                <div class="row">
                                    @foreach (Category Categorym in Categoryler.Skip(i * 3).Take(3))
                                    {
                                        <div class="col-md-4">
                                            <div class="discus-card mt-4">
                                                <div class="kanvas mb-2" style="background-image:url(@Categorym.CategoryThumbnail);"></div>
                                                <div class="card-body text-center mt-2">
                                                    <h2>@Categorym.CategoryTitle.HtmlEncode()</h2>
                                                    @* <p class="card-text">@Partial.PostShortContent(comPost.PostID, 170)</p> *@
                                                </div>
                                                <div class="about-content text-center mb-3">
                                                    <a href="@Partial.CategoryLink(Categorym.CategoryID)" class="readmore-btn" tabindex="0">@Partial.Translate("Devami", lang)</a>
                                                </div>
                                            </div>
                                        </div>
                                    }
                                </div>
                            }
                        }
                <div class="footrow">
                    <nav>
                        <ul class="pagination">
                            @{
                                int bulunduguSayfa = Convert.ToInt32(ViewBag.BulunduguSayfa);
                                int ogeAdedi = Convert.ToInt32(ViewBag.OgeAdedi);
                                string link = Partial.CategoryLink(category.CategoryID);
                                if (ViewBag.CategoryID > 0)
                                {
                                    @Function.Paging(link, bulunduguSayfa, ogeAdedi, Convert.ToInt32(Partial.OptionGetValue("PostCount")), true, "", "page", "active", false, false, 5, "/" + ViewBag.CategoryID + "&sID=", "<<", "<", ">", ">>")
                                }
                                else
                                {
                                    @Function.Paging(link, bulunduguSayfa, ogeAdedi, Convert.ToInt32(Partial.OptionGetValue("PostCount")), true, "", "page", "active", false, false, 5, "/", "<<", "<", ">", ">>")
                                }
                            }
                        </ul>
                    </nav>
                </div>
</div>