/// <summary>
        /// assume that tihs data comes from business layer.
        /// </summary>
        /// <param name="queryString"></param>
        /// <returns></returns>
        private DataGridResponseViewModel GetResponse(DataGridRequestQueryString queryString)
        {
            DataGridResponseViewModel model = new DataGridResponseViewModel(queryString);

            List<SimplePersonViewModel> pList = new List<SimplePersonViewModel>();

            SimplePersonViewModel p = new SimplePersonViewModel();

            for (int i = 0; i < 100; i++)
            {
                p = new SimplePersonViewModel()
                {
                    Salary = i + 10.5,
                    Name = "My name is " + (i + 1),
                    Gender = "E",
                    Id = i,
                    BirthDate = DateTime.Now.AddDays(-1000 + i).ToShortDateString(),
                    ModifiedDate = DateTime.Now.AddDays(-2000 + i).ToShortDateString(),
                };

                pList.Add(p);
            }
            model.data = pList.Skip(queryString.start).Take(queryString.length).ToList();
            model.recordsTotal = pList.Count;

            return model;
        }
        /// <summary>
        /// xhr method that works with dataTables.js server side table
        /// </summary>
        /// <param name="queryString"></param>
        /// <returns></returns>
        public ActionResult FillDataGrid(DataGridRequestQueryString queryString)
        {
            var resp = new DataGridResponseViewModel(queryString)
            {
                //     data = new CustomerDataGenerator().GenerateCustomerList(queryString),
            };

            return Json(resp, JsonRequestBehavior.AllowGet);
        }
 public DataGridResponseViewModel(DataGridRequestQueryString queryString)
 {
     _draw = queryString.draw;
 }
        /// <summary>
        /// xhr method that works with dataTables.js server side table
        /// </summary>
        /// <param name="queryString"></param>
        /// <returns></returns>
        public ActionResult FillDataGrid(DataGridRequestQueryString queryString)
        {
            DataGridResponseViewModel resp = GetResponse(queryString);

            return Json(resp, JsonRequestBehavior.AllowGet);
        }
Esempio n. 5
0
 public DataGridResponseViewModel(DataGridRequestQueryString queryString)
 {
     _draw = queryString.draw;
 }