コード例 #1
0
        public ActionResult ListarModelo(GridDataRequest request)
        {
            int totalRecords = 0;
            var lstGrd       = ModeloBL.LstModeloJGrid(request, ref totalRecords);

            var productsData = new
            {
                total   = (int)Math.Ceiling((float)totalRecords / (float)request.rows),
                page    = request.page,
                records = totalRecords,
                rows    = (from item in lstGrd
                           select new
                {
                    id = item.ModeloId,
                    cell = new string[] {
                        item.ModeloId.ToString(),
                        item.Denominacion,
                        item.MarcaId.ToString(),
                        item.Marca.Denominacion,
                        item.Estado.ToString(),
                        item.ModeloId.ToString() + "," + (item.Estado ? "1":"0")
                    }
                }
                           ).ToArray()
            };

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