0
私はmvcとエンティティフレームワークにはかなり新しくなっているので、ここではページングを設定することはできません。いくつかの前置詞を使用しています。私はページングを設定したいと思っています。たくさんありがとうございます。mvcのアクション結果のページ設定
public ActionResult Gallery(int id, string TopicSystemName)
{
var gallery = _galleryRepo.GetById(id);
var query = _galleryRepo.Table;
if (!string.IsNullOrWhiteSpace(TopicSystemName))
{
query = query.Where(x => x.EffectType.Contains(TopicSystemName));
}
var galleries = new List<GalleryRecord>(query.ToList());
// var galleries = new PagedList<GalleryRecord>(query.ToList(), command.Page - 1, command.PageSize);
List<GalleryRecord> lista = new List<GalleryRecord>();
GalleryRecord galleryRecord = new GalleryRecord();
foreach (var a in galleries)
{
if (a.EffectType == TopicSystemName)
{
gallery = _galleryRepo.GetById(a.GalleryId);
gallery.Images = gallery.Images != null && gallery.Images.Any() ?
gallery.Images.OrderBy(x => x.DisplayOrder).ToList() :
_imageRepo.Table.Where(x => x.GalleryId == gallery.GalleryId).OrderBy(x => x.DisplayOrder).ToList();
lista.Add(gallery);
}
}
// if (gallery == null) return Content("");
//if (gallery.ExtractFromPdf) return View("GalleryCanvas", gallery);
ViewBag.lis = lista;
return View(gallery);
}
foreach (var a in ViewBag.lis)
{
foreach (var galleryImageRecord in a.Images)
{
<div class="thumbnail1 img-responsive " style="position:relative">
<div class="image1 img-responsive ">
<div class="img-responsive fade [email protected](colClassNm) [email protected](colClassNm) col-sm-12 col-xs-12 test" style="min-height:130px;padding-left: 0px; padding-right: 0px;">
<div style="overflow: hidden; text-align: center; border: 0px double #dedede;">
<a class="fancybox-thumb " rel="fancybox-thumb" title="@galleryImageRecord.Caption" href="@galleryImageRecord.FilePath" data-lightbox="test-123">
<img title="@galleryImageRecord.Caption" src="@galleryImageRecord.FilePath" alt="@galleryImageRecord.Caption" width="300" height="280" />
</a>
</div>
}
}
(あなたは[ASP.NET MVCアプリケーションでEntity Frameworkのでソート、フィルタリング、およびページング]で始まるHTTPSを提案します。 microsoft.com/en/us/aspnet/mvc/overview/asp-net-mvc-application) –