public ActionResult GalerilerJson(int page, int rows, string sort, string order)
        {
            var galeriler = galeriServis.Galeriler();

            int pageIndex    = page - 1;
            int pageSize     = rows;
            int totalRecords = galeriler.Count();
            int totalPages   = (int)Math.Ceiling((float)totalRecords / (float)pageSize);

            var result = new
            {
                total = totalRecords,
                rows  = galeriler.Select(x => new
                {
                    Id          = x.Id,
                    Ad          = x.Ad,
                    HaberBaslik = x.Haber.Baslik
                })
                        .AsQueryable()
                        .OrderBy(sort + " " + order)
                        .Skip(pageIndex * pageSize)
                        .Take(pageSize)
                        .ToList()
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult GalerilerJson(int page, int rows, string sort, string order)
        {
            var galeriler = galeriServis.Galeriler(page, rows);

            var result = new
            {
                total = galeriler.KayitSayisi,
                rows  = galeriler.KaynakListe.Select(x => new
                {
                    Id = x.Id,
                    Ad = x.Ad
                })
                        .AsQueryable()
                        .OrderBy(sort + " " + order)
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }