-1
I don’t know anything about Razor or Webmatrix. I took a project already done by another developer and I came across two problems, I can not locate where the SQL queries to list the products and also do not know how to do so when listing the Products, not appear pagination, this is to list directly, all products of the database without paginar. Can you help me? Follow part of the code.
@model IEnumerable<MZANovoMVC4.Models.Produto>
@model PagedList.IPagedList<MZANovoMVC4.Models.Produto>
@using PagedList.Mvc;
@{
ViewBag.Title = "Produtos - ";
Layout = "~/Views/Shared/_Layout_Interno.cshtml";
}
<div class="container">
<main id="content" class="col-md-12 main-blog" tabindex="-1" role="main" asd="1">
<div class="row" style="margin-top:50px; margin-bottom:50px; margin-left:0px; margin-right:0px;">
<div class="col-md-4 filter">
<div class="filtro-produto">
<ul>
<li><a href="~/produtos">TODOS</a></li>
@foreach (var item in ViewBag.Categorias)
{
<li>
<a href="@Url.Action("Index", "Produto", new { idcategoria = item.IDCategoria, categoria = item.TituloTratado })">
@item.Titulo
<img class="sidebar-img" src="@item.Foto">
</a>
</li>
}
</ul>
</div>
</div>
<main id="content" class="col-md-8 main-produto" tabindex="-1" role="main" asd="1">
<div class="category-name">Linha Completa</div>
<div class="produtos-topo" id="response">
@foreach (var item in Model)
{
<article class="box-produto post">
<img src="@item.Foto" width="800" height="450" class="attachment-post-thumbnail size-post-thumbnail wp-post-image"
alt="" sizes="(max-width: 800px) 100vw, 800px" data-lazy-loaded="true" style="display: block;">
<h3>@item.Titulo</h3>
@if (!string.IsNullOrEmpty(@item.Medidas))
{
<h4> Medidas:@item.Medidas</h4>
}
<a href="@Url.Action("Details", "Produto", new { id = item.IDProduto, name = item.TituloTratado})">Ver Produto</a>
</article>
}
</div>
<div style="text-align:center;">
@Html.PagedListPager(Model, p => Url.Action("Index", new { p, b = ViewBag.Busca }))
</div>
</main>
</div>
</main>
</div>
Hello Fabio this project seems to be an MVC project in this case you should have a Controller that is where the logic is and where the data comes from.
– Luciano Oiticica Lemgruber