EF查询

 public ActionResult AllSettings(DataSourceRequest command,

            Framework.Kendoui.Filter filter = null, Sort sort = null)

        {

            var settings = this._settingService.GetAllSettings().Select(x => new SettingModel

                                {

                                    Id = x.Id,

                                    Name = x.Name,

                                    Value = x.Value

                                }).AsQueryable()

                .Filter(filter)

                .Sort(sort);

            int total = settings.Count();





            var totalPages = total / command.PageSize;

            if (total % command.PageSize > 0)

                totalPages++;



            var gridModel = new DataSourceResult

            {

                Data = settings.PagedForCommand(command).ToList(),

                TotalRecords = total,

                TotalPages = totalPages



            };

            return Json(gridModel);

        }

 

你可能感兴趣的:(查询)