阅读背景:

过滤数据库端的选定JSon字段

来源:互联网 

This is my DAL method:

这是我的DAL方法:

public List<Schedule> GetSchedulesWithProfiles(int displayStart, int displayLength, out int allDataCount, out int filteredDatacount, string searchParam = "", string searchDir = "")
        {
            using (var context = new ApplicationDbContext())
            {
                var schedules = context.Schedules.Include(x => x.Profile).Include(x => x.VacationType);
                allDataCount = schedules.Count();
                if (!string.IsNullOrEmpty(searchParam))
                {
                    schedules = schedules.Where(c => c.Data.Contains(searchParam));     
                }
                filteredDatacount = schedules.Count();
                if (searchDir == "asc" || String.IsNullOrEmpty(searchDir))
                    schedules = schedules.OrderBy(x => x.Data).Skip(displayStart).Take(displayLength);
                else
                    schedules = schedules.OrderByDescending(x => x.Data).Skip(displayStart).Take(displayLength);
                return schedules.ToList();
              }
        }
public Li



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: