Beispiel #1
0
        /// <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);
        }
Beispiel #2
0
        private List <SimplePersonViewModel> GetSimplePersonViewList()
        {
            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);
            }
            return(pList);
        }