Exemple #1
0
        public ActionResult GetData3(GridOptions options)
        {
            int skipValue = ((options.Page - 1) * options.Rows);

            using (Repository.BaseballDataContext ctx = new Repository.BaseballDataContext(_connectionString))
            {
                IEnumerable <Repository.BatterDetail>   results;
                Expression <Func <BatterDetail, bool> > predicate;

                if (options.IsSearch)
                {
                    predicate = SearchHelper.CreateSearchPredicate(options);
                }
                else
                {
                    predicate = b => b.yearID > 2005;
                }

                results = ctx.BatterDetails
                          .Where(predicate);

                string dataString = CreateJSONStringForGridData(options, skipValue, results);

                return(Content(dataString, "application/json", System.Text.Encoding.UTF8));
            }
        }
        public ActionResult GetData2(GridOptions options)
        {
            int skipValue = ((options.Page - 1) * options.Rows);
            using (Repository.BaseballDataContext ctx = new Repository.BaseballDataContext(_connectionString))
            {
                IEnumerable<Repository.BatterDetail> results;
                if (options.IsSearch)
                {
                    if (options.Filters.FilterRules[0].Operation== GridSearchOperation.EQ)
                    {
                        results = ctx.BatterDetails
                                    .Where(b => b.nameLast == options.Filters.FilterRules[0].FieldData);
                    }
                    else if (options.Filters.FilterRules[0].Operation== GridSearchOperation.NE)
                    {
                        results = ctx.BatterDetails
                                    .Where(b => b.nameLast != options.Filters.FilterRules[0].FieldData);
                    }
                    else
                    {
                        results = ctx.BatterDetails
                                        .Where(b => b.yearID > 2005);
                    }
                }
                else
                {
                    results = ctx.BatterDetails
                                    .Where(b => b.yearID > 2005);
                }

                string dataString = CreateJSONStringForGridData(options, skipValue, results);

                return Content(dataString, "application/json", System.Text.Encoding.UTF8);
            }
        }
Exemple #3
0
        public ActionResult GetData(GridOptions options)
        {
            int skipValue = ((options.Page - 1) * options.Rows);

            using (Repository.BaseballDataContext ctx = new Repository.BaseballDataContext(_connectionString))
            {
                var results = ctx.BatterDetails
                              .Where(b => b.yearID > 2005);

                string dataString = CreateJSONStringForGridData(options, skipValue, results);

                return(Content(dataString, "application/json", System.Text.Encoding.UTF8));
            }
        }
        public ActionResult GetData(GridOptions options)
        {
            int skipValue = ((options.Page - 1) * options.Rows);

            using (Repository.BaseballDataContext ctx = new Repository.BaseballDataContext(_connectionString))
            {
                var results = ctx.BatterDetails
                                    .Where(b => b.yearID > 2005);

                string dataString = CreateJSONStringForGridData(options, skipValue, results);

                return Content(dataString, "application/json", System.Text.Encoding.UTF8);
            }
        }
Exemple #5
0
        public ActionResult GetData2(GridOptions options)
        {
            int skipValue = ((options.Page - 1) * options.Rows);

            using (Repository.BaseballDataContext ctx = new Repository.BaseballDataContext(_connectionString))
            {
                IEnumerable <Repository.BatterDetail> results;
                if (options.IsSearch)
                {
                    if (options.Filters.FilterRules[0].Operation == GridSearchOperation.EQ)
                    {
                        results = ctx.BatterDetails
                                  .Where(b => b.nameLast == options.Filters.FilterRules[0].FieldData);
                    }
                    else if (options.Filters.FilterRules[0].Operation == GridSearchOperation.NE)
                    {
                        results = ctx.BatterDetails
                                  .Where(b => b.nameLast != options.Filters.FilterRules[0].FieldData);
                    }
                    else
                    {
                        results = ctx.BatterDetails
                                  .Where(b => b.yearID > 2005);
                    }
                }
                else
                {
                    results = ctx.BatterDetails
                              .Where(b => b.yearID > 2005);
                }

                string dataString = CreateJSONStringForGridData(options, skipValue, results);

                return(Content(dataString, "application/json", System.Text.Encoding.UTF8));
            }
        }
        public ActionResult GetData3(GridOptions options)
        {
            int skipValue = ((options.Page - 1) * options.Rows);
            using (Repository.BaseballDataContext ctx = new Repository.BaseballDataContext(_connectionString))
            {
                IEnumerable<Repository.BatterDetail> results;
                Expression<Func<BatterDetail, bool>> predicate;

                if (options.IsSearch)
                {
                    predicate = SearchHelper.CreateSearchPredicate(options);
                }
                else
                {
                    predicate = b => b.yearID > 2005;
                }

                results = ctx.BatterDetails
                                .Where(predicate);

                string dataString = CreateJSONStringForGridData(options, skipValue, results);

                return Content(dataString, "application/json", System.Text.Encoding.UTF8);
            }
        }