예제 #1
0
        /// <summary>
        /// Gets the clients from the database.
        /// </summary>
        public ActionResult GetProjects(JqGridParametersModel parameters)
        {
            var projects = _processor.GetProjects(User.Identity.Name).ToList();
            var models   = projects.OrderBy(p => p.Client.ClientName).ThenBy(p => p.ProjectName)
                           .Select(p => new ProjectModel(p))
                           .Skip(parameters.Rows * (parameters.Page - 1))
                           .Take(parameters.Rows).ToList();
            var recordCount = projects.Count;

            return
                (Json(
                     new JqJsonModel <ProjectModel>(models)
            {
                CurrentPage = parameters.Page == 0 ? 1 : parameters.Page,
                RecordCount = recordCount,
                TotalPages =
                    recordCount % parameters.Rows == 0
                                ? recordCount / parameters.Rows
                                : (recordCount / parameters.Rows) + 1
            },
                     JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public ActionResult GetProjects()
        {
            var projectModels = _processor.GetProjects(User.Identity.Name).Select(p => new ProjectModel(p));

            return(View(new GridModel <ProjectModel>(projectModels)));
        }