//ToDo: Add edit delete feature shoule be added.
 public JsonResult SimpleCrudJsonData(JqGridPost post)
 {
     using (var ctx = new AdventureWorksLTEntities())
     {
         //var customer = ctx.Customer.OrderBy(m => m.CustomerID).Skip(postModel.page * postModel.rows).Take(postModel.rows).ToList();
         var customer = new PagedList<Customer>(ctx.Customer.OrderBy(m => m.CustomerID), post.page, post.rows);
         var jqRows = new List<JqGridRow>();
         foreach (var item in customer)
         {
             jqRows.Add(new JqGridRow
             {
                 id = item.CustomerID.ToString(),
                 cell = { item.CustomerID, item.FirstName, item.LastName, item.EmailAddress, item.Phone }
             });
         }
         var json = new JqGridData
         {
             page = post.page,
             records = customer.TotalCount,
             total = customer.TotalPages,
             rows = jqRows
         };
         return Json(json, JsonRequestBehavior.AllowGet);
     }
 }
        public JsonResult ToolbarSearchingAjaxPost(JqGridPost post)
        {
            var products = _productRepository.Table.OrderBy(m => m.ProductID);

            var jqRows = products.ToList().Select(item => new GridRow
            {
                Id = item.ProductID.ToString(),
                Cell = { item.ProductID, item.Name, item.Size, item.ProductCategory.Name, item.ListPrice }
            }).ToList();
            var json = products.ToJqGridData(post.page, post.rows, jqRows);
            return Json(json.ToData(), JsonRequestBehavior.AllowGet);
        }
        public JsonResult UsingNavigatorsAjaxPost(JqGridPost post)
        {
            var product = new PagedList<Product>(
                    _productRepository.Table.OrderBy(m => m.ProductID), post.page, post.rows);

            var jqRows = product.Select(item => new GridRow
            {
                Id = item.ProductID.ToString(),
                Cell = { item.ProductID, item.Name, item.Size, item.ProductCategory.Name, item.ListPrice }
            }).ToList();
            var json = product.ToJqGridData(post.page, jqRows);
            return Json(json.ToData(), JsonRequestBehavior.AllowGet);
        }
        public ActionResult XmlLoadAjaxPost(JqGridPost post)
        {
            var products = new PagedList<Product>(
                    _productRepository.Table.OrderBy(m => m.ProductID), post.page, post.rows);

            var jqRows = products.Select(item => new GridRow
            {
                Id = item.ProductID.ToString(),
                Cell = { item.ProductID, item.Name, item.Size, item.ProductCategory.Name, item.ListPrice }
            }).ToList();
            var json = products.ToJqGridData(post.page, jqRows);
            return Content(json.ToData().ToXml(), "text/xml");
        }
 //ToDo: Add edit delete features with different input boxes
 public ActionResult OtherInputBoxesJsonData(JqGridPost post)
 {
     //var productList = _productRepository.Table.ToList();
     using (var ctx = new AdventureWorksLTEntities())
     {
         var product = new PagedList<Product>(
             ctx.Product.OrderBy(m => m.ProductID), post.page, post.rows);
         
         var jqRows = product.Select(item => new GridRow
                 {
                     Id = item.ProductID.ToString(), 
                     Cell = {item.ProductID, item.Name, item.Size, item.ProductCategory.Name, item.ListPrice}
                 }).ToList();
         var json = product.ToJqGridData(post.page, jqRows);
         return Json(json.ToData(), JsonRequestBehavior.AllowGet);
         //return new XmlResult(json);
     }
 }
 public ActionResult InputJsonData(JqGridPost post)
 {
     using (var ctx = new AdventureWorksLTEntities())
     {
         //var customer = ctx.Customer.OrderBy(m => m.CustomerID).Skip(postModel.page * postModel.rows).Take(postModel.rows).ToList();
         var product = new PagedList<Product>(
             ctx.Product.OrderBy(m => m.ProductID), post.page, post.rows);
         var jqRows = new List<GridRow>();
         foreach (var item in product)
         {
             
             jqRows.Add(new GridRow
             {
                 Id = item.ProductID.ToString(),
                 Cell = new List<object> { item.ProductID, item.Name, item.Size, item.ProductCategory.Name, item.ListPrice }
             });
         }
         var json = new GridData
         {
             Page = post.page,
             Records = product.TotalCount,
             Total = product.TotalPages,
             Rows = jqRows
         };
         //var json = product.ToJqGridData(jqRows);
         return Json(json, JsonRequestBehavior.AllowGet);
         //return new XmlResult(json);
     }
 }