Ejemplo n.º 1
0
        public virtual ActionResult List(string sidx, string sord, int page, int rows)
        {
            int totalRecords = 0;
            var packets      = _mPacketRepository.GetPagedPacketList(sidx, sord, page, rows, ref totalRecords);
            int pageSize     = rows;
            int totalPages   = (int)Math.Ceiling((float)totalRecords / (float)pageSize);

            var jsonData = new
            {
                total   = totalPages,
                page    = page,
                records = totalRecords,
                rows    = (
                    from packet in packets
                    select new
                {
                    i = packet.Id.ToString(),
                    cell = new string[] {
                        string.Empty,
                        packet.Id,
                        packet.PacketName,
                        packet.PacketPrice.HasValue ?  packet.PacketPrice.Value.ToString(Helper.CommonHelper.NumberFormat) : null,
                        packet.PacketPriceVip.HasValue ?  packet.PacketPriceVip.Value.ToString(Helper.CommonHelper.NumberFormat) : null,
                        packet.PacketStatus,
                        packet.PacketDesc
                    }
                }).ToArray()
            };


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